3

I'm using this functional.suite.yml:

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

I build and run tests and get:

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'

I have no idea how to make this runs. Any suggestions?

1 Answer 1

2

It looks like a usual version conflict between Codeception phar file and libraries installed by Composer.

Codeception file is bundled with PHPUnit 4.8.23, but you have PHPUnit <4.7.0 installed in vendor directory and autoloader managed to load PHPUnit_Util_Test class from vendor directory.

Uninstall PHPUnit from vendor or install Codeception with Composer instead.

Link to relevant change in PHPUnit: https://github.com/sebastianbergmann/phpunit/commit/32feefd37c820d122acac70fff0ee25cf0764612#diff-d2b0b699e9f0cfd6bd35cb3338167223R37

Sign up to request clarification or add additional context in comments.

4 Comments

Yeah, Codeception phar automatically use vendor version if that was found. It's strange for me, but using only phar or vendor works.
@SebastianTkaczyk I implemented that feature in version 2.2.10 in February 2017. Is it causing any issues to you?
For me it's not intuitive. Its obvious to me, that when on upgrading some version of code (test for PHPUnit for ex.) I'v got in vendor my old version. And for test/migration purposes i download new version i .phar format, to run my code using it. If I remember, I was migrating my old codeception tests, and want to check how does it run on new version.
At least it works now. I recommend to avoid using phar and use local composer installation instead. Phar file or global composer installation can have a different version of Symfony components and cause unexpected errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.