【发布时间】:2011-07-04 20:24:10
【问题描述】:
我创建了自己的代码嗅探器规则标准。它们运行良好。现在我想使用 PHP UnitTest 测试代码嗅探器规则。 PhpCodesniffer 已经有了他们的 PHPUnit 测试用例框架。
因此,我使用它扩展了他们的AbstractSniffUnitTest 和位置的单元测试类
Standards/TestRules/Tests/Function/FunctionUnitTest.php 和要测试的脚本保存在 Standards/TestRules/Tests/Function/FunctionUnitTest.inc 中。
但是当我要通过命令phpunit PEAR\PHP\tests\AllTests.php 运行脚本时,它会出现以下错误。
PHPUnit 3.5.14 by Sebastian Bergmann.
......................................F
Time: 6 seconds, Memory: 10.00Mb
There was 1 failure:
1) TestRules_Tests_Function_FunctionUnitTest::getErrorList
An unexpected exception has been caught: Source file C:/Program Files/PHP/PEAR/PHP/CodeSniffer/Standards/TestRules/Tests/Function/FunctionUnitTest.inc does not exist
C:\Program Files\PHP\PEAR\PHP\tests\Standards\AbstractSniffUnitTest.php:138
C:\Program Files\PHP\PEAR\PHP\tests\TestSuite.php:48
FAILURES!
Tests: 39, Assertions: 146, Failures: 1.
Warning: Deprecated PHPUnit features are being used 2 times!
Use --verbose for more information.
它给出了错误文件FunctionUnitTest.inc not found at given location。我已授予文件夹的完全权限,还验证了路径和文件位置,但它给出了同样的错误。我也在linux机器上测试过,但它给出了同样的错误。
是我的代码问题还是代码嗅探器单元测试框架问题?
【问题讨论】:
-
请尝试
--verbose开关并添加扩展输出。
标签: php phpunit codesniffer