Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^118) CHAPTER 8 ■ TESTING, DEPLOYMENT, AND CONTINUOUS INTEGRATION
phing
Buildfile: /home/user/myfirstrepo/build.xml
MyFirstPhingProject > get:
[svnupdate] Updating SVN repository at '.'
MyFirstPhingProject > test:
[phpunit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.00035 sec
MyFirstPhingProject > try:
[copy] Copying 2 files to /usr/local/www/beta.example.com/document_root
BUILD FINISHED
Total time: 0.2601 seconds
To call a specific target, simply call phing . Here’s how to call deploy:



phing deploy
//... all of above plus...
MyFirstPhingProject > deploy:
[copy] Copying 2 files to /usr/local/www/www.book.lan/document_root
At this point, you have a Phing deployment system. You could stop here, and you would
have a respectable deployment solution. However, you still need to call phing manually when
you want to get, test, and try—common development actions that will become tedious quickly.
Fortunately these, too, can be automated.
■Note Phing can be configured to produce PEAR packages, encode your projects, generate code-coverage
reports, and more. See http://www.phing.info for more information.



Xinc, the Continuous Integration Server


Xinc is a way to continuously integrate a PHP project. Essentially, Xinc monitors a Subversion
repository for changes, and when changes are detected, automatically calls Phing.

Installing Xinc


Installing Xinc 1.0 is trivial. First download the binary package from http://code.google.com/
p/xinc/, and then install it, as follows:

McArthur_819-9C08.fm Page 118 Friday, February 22, 2008 9:06 AM

Free download pdf