PHPUnit在山狮上引发错误

时间:2014-03-11 11:13:17

标签: phpunit

我已按照此处所述的说明进行操作 http://phpunit.de/getting-started.html

一切顺利但我执行以下命令时

phpunit --bootstrap src/autoload.php tests/MoneyTest

抛出以下错误

PHPUnit 4.0.4 by Sebastian Bergmann.
PHP Fatal error:  Class 'SebastianBergmann\Money\Money' not found in /Users/myname/Sites/lab/unittesting/tests/MoneyTest.php on line 54
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:581
PHP   3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:132
PHP   4. PHPUnit_TextUI_TestRunner->doRun() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:179
PHP   5. PHPUnit_Framework_TestSuite->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php:419
PHP   6. PHPUnit_Framework_TestCase->run() phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php:722
PHP   7. PHPUnit_Framework_TestResult->run() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:764
PHP   8. PHPUnit_Framework_TestCase->runBare() phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php:692
PHP   9. PHPUnit_Framework_TestCase->runTest() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:824
PHP  10. ReflectionMethod->invokeArgs() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:956
PHP  11. SebastianBergmann\Money\MoneyTest->testExceptionIsRaisedForInvalidConstructorArguments() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:956

知道可能是什么原因?

由于

1 个答案:

答案 0 :(得分:1)

以下说明适用于我:

$ git clone https://github.com/sebastianbergmann/money

$ cd money

$ phpunit --bootstrap src/autoload.php tests/MoneyTest

PHPUnit 3.7.32 by Sebastian Bergmann.

......................

Time: 882 ms, Memory: 3.25Mb

OK (22 tests, 41 assertions)

请注意,我使用的是3.7.32,而您使用的是4.0.4。如果它仍然不起作用那么它可能是一个错误。

相关问题