Can't accomplish build with Jenkins, Symfony3 and PHPUnit 5.3

mykbas

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?

Kuba Birecki

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't accomplish build with Jenkins, Symfony3 and PHPUnit 5.3

From Dev

Symfony3 testing the redirectToRoute() method with phpunit

From Dev

Can't install DoctrineMigrationsBundle with Symfony3 using composer

From Dev

Can't send data to the Controller with a POST method Symfony3

From Dev

Build category tree Symfony3

From Dev

Symfony3 report generation (html) of PHPUnit does not work

From Dev

Symfony3 HWIOauth Bundle can't use/find Google Login-Check route

From Dev

Symfony3 on Google App Engine Flexible can't connect to Google Cloud SQL MySQL

From Dev

Nativescript can't build - v3

From Dev

Symfony3 Doctrine2 can not access variable in the loop

From Dev

Symfony3 Doctrine2 can not access variable in the loop

From Dev

access_control in Symfony3 doesn't work

From Dev

Symfony3 authorization doesn't work - always wrong credentials

From Dev

Ajax with Symfony3

From Dev

How can I check if request was a POST or GET request in Symfony2 or Symfony3

From Dev

Can't make Jenkins trigger a build on Github changes

From Dev

Symfony 3: can't overwrite repository

From Dev

Symfony3 execute phpmetrics

From Dev

Symfony3 Profiler Storage

From Dev

Symfony3: Routing & Cache

From Dev

Symfony3 - Phone Number

From Dev

Symfony3 Debugging with PhpStorm

From Dev

Config Symfony3 URL

From Dev

using ckeditor in symfony3

From Dev

Symfony3 auditing controllers

From Dev

Symfony3 Debugging with PhpStorm

From Dev

Security and login - symfony3

From Dev

using ckeditor in symfony3

From Dev

Symfony3 search by relations