我正在尝试使用Travis CI执行测试,然后部署到服务器。
我使用composer安装Symfony 3.4而不包含任何代码行
composer create-project symfony/framework-standard-edition symfony/ "3.*"
我只创建了一个.travis.yml文件来运行Travis CI上的测试
language: php
php:
- '5.6'
before_script:
- composer self-update
- cp app/config/parameters.yml.dist app/config/parameters.yml
- composer install
在推动此更改后,在Travis CI的作业日志中我得到此输出
$ phpunit
PHPUnit 5.7.23 by Sebastian Bergmann and contributors.
PHP Fatal error: Call to undefined method Symfony\Component\Yaml\Parser::parseFile() in /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php on line 667
PHP Stack trace:
PHP 1. {main}() /home/travis/.phpenv/versions/5.6.32/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/travis/.phpenv/versions/5.6.32/bin/phpunit:592
PHP 3. PHPUnit_TextUI_Command->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/TextUI/Command.php:116
PHP 4. PHPUnit_TextUI_TestRunner->doRun() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/TextUI/Command.php:186
PHP 5. PHPUnit_Framework_TestSuite->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/TextUI/TestRunner.php:517
PHP 6. PHPUnit_Framework_TestSuite->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestSuite.php:722
PHP 7. PHPUnit_Framework_TestCase->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestSuite.php:722
PHP 8. PHPUnit_Framework_TestResult->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:868
PHP 9. PHPUnit_Framework_TestCase->runBare() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestResult.php:686
PHP 10. PHPUnit_Framework_TestCase->runTest() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:913
PHP 11. ReflectionMethod->invokeArgs() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:1062
PHP 12. Tests\AppBundle\Controller\DefaultControllerTest->testIndex() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:1062
PHP 13. Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient() /home/travis/build/User/PruebaTravis/tests/AppBundle/Controller/DefaultControllerTest.php:11
PHP 14. Symfony\Bundle\FrameworkBundle\Test\KernelTestCase::bootKernel() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33
PHP 15. Symfony\Component\HttpKernel\Kernel->boot() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:166
PHP 16. Symfony\Component\HttpKernel\Kernel->initializeContainer() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:137
PHP 17. Symfony\Component\HttpKernel\Kernel->buildContainer() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:642
PHP 18. AppKernel->registerContainerConfiguration() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:774
PHP 19. Symfony\Component\Config\Loader\DelegatingLoader->load() /home/travis/build/User/PruebaTravis/app/AppKernel.php:59
PHP 20. Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/DelegatingLoader.php:40
PHP 21. Symfony\Component\DependencyInjection\Loader\YamlFileLoader->loadFile() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php:117
Fatal error: Call to undefined method Symfony\Component\Yaml\Parser::parseFile() in /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php on line 667
Call Stack:
0.0015 490240 1. {main}() /home/travis/.phpenv/versions/5.6.32/bin/phpunit:0
0.1007 15628304 2. PHPUnit_TextUI_Command::main() /home/travis/.phpenv/versions/5.6.32/bin/phpunit:592
0.1007 15637456 3. PHPUnit_TextUI_Command->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/TextUI/Command.php:116
0.1135 16647568 4. PHPUnit_TextUI_TestRunner->doRun() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/TextUI/Command.php:186
0.1191 16664024 5. PHPUnit_Framework_TestSuite->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/TextUI/TestRunner.php:517
0.1193 16667456 6. PHPUnit_Framework_TestSuite->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestSuite.php:722
0.1261 16671696 7. PHPUnit_Framework_TestCase->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestSuite.php:722
0.1261 16673800 8. PHPUnit_Framework_TestResult->run() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:868
0.1262 16677744 9. PHPUnit_Framework_TestCase->runBare() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestResult.php:686
0.1264 16696184 10. PHPUnit_Framework_TestCase->runTest() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:913
0.1264 16697176 11. ReflectionMethod->invokeArgs() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:1062
0.1264 16697352 12. Tests\AppBundle\Controller\DefaultControllerTest->testIndex() phar:///home/travis/.phpenv/versions/5.6.32/bin/phpunit/phpunit/Framework/TestCase.php:1062
0.1264 16697432 13. Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient() /home/travis/build/User/PruebaTravis/tests/AppBundle/Controller/DefaultControllerTest.php:11
0.1264 16697816 14. Symfony\Bundle\FrameworkBundle\Test\KernelTestCase::bootKernel() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33
0.1288 17079808 15. Symfony\Component\HttpKernel\Kernel->boot() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:166
0.1319 17408248 16. Symfony\Component\HttpKernel\Kernel->initializeContainer() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:137
0.1328 17483704 17. Symfony\Component\HttpKernel\Kernel->buildContainer() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:642
0.2078 25037344 18. AppKernel->registerContainerConfiguration() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:774
0.2084 25038928 19. Symfony\Component\Config\Loader\DelegatingLoader->load() /home/travis/build/User/PruebaTravis/app/AppKernel.php:59
0.2084 25039296 20. Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/DelegatingLoader.php:40
0.2085 25039864 21. Symfony\Component\DependencyInjection\Loader\YamlFileLoader->loadFile() /home/travis/build/User/PruebaTravis/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php:117
THE ERROR HANDLER HAS CHANGED!
The command "phpunit" exited with 255.
Done. Your build exited with 1.
答案 0 :(得分:0)
安装symfony/phpunit-bridge
并执行vendor/bin/simple-phpunit
而不是phpunit
$ cd my-project/
$ composer require --dev symfony/phpunit-bridge
$ ./vendor/bin/simple-phpunit
这是一个已知问题,Symfony提供了this solution。