CHAPTER 20 ■ CONTINUOUS INTEGRATION
Performing PHP_CodeBrowser task.
- Creating browser dir: project/userthing/build/php-code-browser
- Modifying config file: config.xml
Performing ezcGraph task. - Modifying config file: config.xml
phpuc helpfully tells you exactly what it’s up to. As you can see it amends one or both of config.xml
and build.xml for each of the tasks I want CruiseControl to run.
By the time you read this, running phpuc in this way might be enough to get you up and running. At
the time of this writing though, there are a few issues that must first be addressed. phpUnderControl is a
beta product, after all.
First of all phpuc writes an element to the config.xml file that CruiseControl 2.8.3 chokes on. If you
find this line in config.xml:
and either comment it out, or delete it, you should avoid a fatal error.
Secondly, phpuc writes a call to itself into the main configuration file at config.xml. Here’s the
relevant section:
CruiseControl allows you to add your own publishers to provide custom reports for the user.
Unfortunately, there is a bug with the phpuc graph command that, at the time of this writing, prevents
the command from running. The workaround is to remove a file from the PEAR repository:
$ rm /usr/share/pear/phpUnderControl/Graph/Input/ClassComplexityInput.php
where /usr/share/pear is my PEAR directory. You can find yours with the command:
$ pear config-get php_dir
Since this problem may be fixed by now, you might skip this step, but bear it mind if the project
metrics reports are not generated.
Lastly, I must make a change that is related to my setup, rather than to a problem with the phpuc
command. I like to keep my source code in a subdirectory (named src/) within my project. That way I
can add housekeeping scripts, documentation, and other miscellanea at the top level. phpuc asks me to
specify the test directory in my command line arguments, but it will construct a call from the root of my
source directory. So if I tell phpuc that my test directory is to be found at src/test/ and that my test suite
is in UserTests.php, it will construct a call to src/test/UserTest.php.
Because my tests are designed to be run from the src/ directory, this will fail. All my require
statements use paths that are relative to src/ as a starting point, and not its parent directory. Showing
you how to change this also gives us the opportunity to take a quick look at the build.xml file.