Trying to learn CI, I got stuck with the following problem: Ant in command-line gives 'BUILD SUCCESSFUL' message. When I push code to GitHub and run Jenkins on AWS, evth pass except PHPUnit part error:
> phpunit:
[phpunit] PHP Warning: require(/var/lib/jenkins/workspace/mavajob/app/../vendor/autoload.php): failed to open stream: No such file or directory in /var/lib/jenkins/workspace/mavajob/app/autoload.php on line 9
[phpunit] PHP Stack trace:
[phpunit] PHP 1. {main}() /usr/bin/phpunit:0
[phpunit] PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:29
[phpunit] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:106
[phpunit] PHP 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:117
[phpunit] PHP 5. PHPUnit_TextUI_Command->handleBootstrap() /usr/share/php/PHPUnit/TextUI/Command.php:622
[phpunit] PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/TextUI/Command.php:793
[phpunit] PHP 7. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:38
[phpunit] PHP 8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:56
[phpunit] PHP Fatal error: require(): Failed opening required '/var/lib/jenkins/workspace/mavajob/app/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/lib/jenkins/workspace/mavajob/app/autoload.php on line 9
[phpunit] PHP Stack trace:
[phpunit] PHP 1. {main}() /usr/bin/phpunit:0
[phpunit] PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:29
[phpunit] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:106
[phpunit] PHP 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:117
[phpunit] PHP 5. PHPUnit_TextUI_Command->handleBootstrap() /usr/share/php/PHPUnit/TextUI/Command.php:622
[phpunit] PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/TextUI/Command.php:793
[phpunit] PHP 7. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:38
[phpunit] PHP 8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:56
[phpunit] Result: 255
I followed these instructions http://jenkins-php.org/automation.html Maybe somebody could provide working examples for build.xml and phpunit.xml for Symfony3?
It looks to me as if you forgot to run composer install
on the CI server before trying to execute PHPUnit.
Just add another target for composer (assuming you have composer already installed):
<target name="composer" description="Installing composer dependencies">
<exec executable="composer" failonerror="true">
<arg value="install" />
</exec>
</target>
And make it a dependency of other targets that need it. For example, for full-build
, you'd put it right after prepare:
<target name="full-build"
depends="prepare,composer,static-analysis,phpunit,phpdox,-check-failure"
description="Performs static analysis, runs the tests, and generates project documentation"/>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments