Drupal Testing: PHP: 06: Jenkins PHPUnit Project

 

The goal of this project is to provide a standard template for Jenkins jobs for PHP projects.

Simply follow these four steps to get started:

  1. Install the required Jenkins plugins and PHP tools
  2. Orchestrate the PHP tools using Apache Ant
  3. Configure the PHP tools for use with Jenkins job template
  4. Create a Jenkins job for your PHP project

Required Jenkins Plugins

You need to install the following plugins for Jenkins:

You can install these plugins using the web frontend at

http://localhost:8080/pluginManager/available
or using the Jenkins CLI:

 

wget http://localhost:8080/jnlpJars/jenkins-cli.jar

java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin checkstyle cloverphp crap4j dry htmlpublisher jdepend plot pmd violations warnings xunit

java -jar jenkins-cli.jar -s http://localhost:8080 safe-restart

If you see an error message such as "checkstyle is neither a valid file, URL, nor a plugin artifact name in the update center No update center data is retrieved yet", you need to update your plugin list manually:

curl -L https://updates.jenkins-ci.org/update-center.json | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://localhost:8080/updateCenter/byId/default/postBack

In the above, replace localhost:8080 with the hostname and port of your Jenkins installation.

Required PHP Tools

The following PHP tools are required:

We assume that these tools are on the $PATH and can be invoked with phpunit, phpcs, phploc, pdepend, phpmd, phpcpd, and phpdox, respectively. For instance because you have downloaded the respective PHP archives (PHAR) and put them into your $PATH or because you have installed the tools globally using Composer.


 

 

 

Tags