如何使用 Symfony2 配置代码接收功能测试?

How to configure codeception for functional test with Symfony2?

我正在使用这个 functional.suite.yml:

class_name: FunctionalTester
modules:
    enabled:
        - Symfony2
        - \Helper\Functional

我构建并 运行 测试并得到:

Trying to Log in and see result (LoginCept)... PHP Fatal error:  Undefined class constant 'UNKNOWN' in phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestResult.php on line 592
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/codecept:0
PHP   2. require_once() /usr/local/bin/codecept:7
PHP   3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/codecept/codecept:34
PHP   4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/codecept/vendor/symfony/console/Application.php:123
PHP   5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/codecept/vendor/symfony/console/Application.php:192
PHP   6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/codecept/vendor/symfony/console/Application.php:844
PHP   7. Codeception\Command\Run->execute() phar:///usr/local/bin/codecept/vendor/symfony/console/Command/Command.php:259
PHP   8. Codeception\Command\Run->runSuites() phar:///usr/local/bin/codecept/src/Codeception/Command/Run.php:189
PHP   9. Codeception\Codecept->run() phar:///usr/local/bin/codecept/src/Codeception/Command/Run.php:262
PHP  10. Codeception\Codecept->runSuite() phar:///usr/local/bin/codecept/src/Codeception/Codecept.php:172
PHP  11. Codeception\SuiteManager->run() phar:///usr/local/bin/codecept/src/Codeception/Codecept.php:203
PHP  12. Codeception\PHPUnit\Runner->doEnhancedRun() phar:///usr/local/bin/codecept/src/Codeception/SuiteManager.php:153
PHP  13. PHPUnit_Framework_TestSuite->run() phar:///usr/local/bin/codecept/src/Codeception/PHPUnit/Runner.php:89
PHP  14. PHPUnit_Framework_TestCase->run() phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP  15. PHPUnit_Framework_TestResult->run() phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php:724



FATAL ERROR. TESTS NOT FINISHED.
Undefined class constant 'UNKNOWN'

我不知道如何制作这个 运行s。有什么建议吗?

看起来像是 Codeception phar 文件和 Composer 安装的库之间的常见版本冲突。

Codeception 文件与 PHPUnit 4.8.23 捆绑在一起,但您在供应商目录中安装了 PHPUnit <4.7.0,并且自动加载器设法从供应商目录加载 PHPUnit_Util_Test class。

从供应商处卸载 PHPUnit 或使用 Composer 安装 Codeception。

Link PHPUnit 中的相关更改: https://github.com/sebastianbergmann/phpunit/commit/32feefd37c820d122acac70fff0ee25cf0764612#diff-d2b0b699e9f0cfd6bd35cb3338167223R37