PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
CHAPTER 20 ■ CONTINUOUS INTEGRATION

useful as the documentation is, it might give you the impression that you won’t be up and running with
a build and test cycle any time soon.
phpuc comes to the rescue, though, with the project command. This creates the required files and
directories, and amends any configuration files.


phpuc project --source-dir src \
--version-control svn \
--version-control-url file:///var/local/svn/userthing/trunk \
--test-dir test \
--test-case UserTests \
--test-file UserTests.php \
--coding-guideline Zend \
--project-name userthing \
/usr/local/cruisecontrol/


■Note If I were running CruiseControl on system remote from my version control repository, I’d also want to set


the user and password options.


Much of this should be self-explanatory. CruiseControl will need access to the userthing source, so,
through phpuc, I need to tell it I’m using Subversion, and provide it with the URL for the code. Then I tell
it where to find the tests, the coding standard I wish to apply. To set things up, phpUnderControl needs
to know where to find the cruisecontrol directory, so I provide the path. The output of the phpuc
project command gives you a good idea of the work that needs to be done in order to pass on this
information.


Performing project task.



  1. Creating project directory: projects/userthing

  2. Creating source directory: projects/userthing/source

  3. Creating build directory: projects/userthing/build

  4. Creating log directory: projects/userthing/build/logs

  5. Creating build file: projects/userthing/build.xml

  6. Creating backup of file: config.xml.orig

  7. Searching ant directory

  8. Modifying project file: config.xml
    Performing checkout task.

  9. Checking out project.

  10. Preparing config.xml file.

  11. Preparing build.xml checkout target.
    Performing PhpDocumentor task.

  12. Creating apidoc dir: project/userthing/build/api

  13. Modifying build file: project/userthing/build.xml

  14. Modifying config file: config.xml
    Performing PHP_CodeSniffer task.

  15. Modifying build file: project/userthing/build.xml
    Performing PHPUnit task.

  16. Creating coverage dir: project/userthing/build/coverage

  17. Modifying build file: project/userthing/build.xml

  18. Modifying config file: config.xml

Free download pdf