PHP Continuous Integration: A first attempt

Monday 22 November 2010 4:11:39 am

By : Thiago Campos Viana

In this post I will create a walkthrough on how to set up an php continuous enviroment on Windows. This is not a complete post, I will need your help to make it perfect.

 Download XAMMP Lite
 
 http://www.apachefriends.org/en/xampp-windows.html
 
 Install it in C:\
 
 \apache\conf\httpd.conf
 
 Uncoment #LoadModule rewrite_module modules/mod_rewrite.so 
 Change the settings in the file: C:\xampplite\php\php.ini
 

max_execution_time 180
max_input_time 180
memory_limit 128

 
 
 
 
 ########################
 
 Control Panel->System->Advanced->Environment Variables->User Variables for XXXX
 Add or change the PATH variable with the value: C:\xampplite\php
 
 ########################
 Download XDebug
 
 http://xdebug.org/download.php
 
Rename the dll file to XDebug to php_xdebug.dll
 
Move it to C:\xampplite\php\ext
 
 
Open the file C:\xampplite\php\php.ini:
 

# At the XDebug block add: zend_extension = "XAMPP_HOME\php\ext\php_xdebug.dll".
 # Find and uncomment the line: xdebug.remote_host=localhost. Change the value of the setting from localhost to 127.0.0.1.
 # Find and uncomment the line: xdebug.remote_enable = 0. Change 0 to 1.
 # Find and uncomment the line: xdebug.remote_handler = "dbgp".
 # Find and uncomment the line: xdebug.remote_port = 9000.
 # Save the php.ini file.

 
 
 
 ########################
 
 Install pear extensions
 
 Start->Run->Type "cmd"
 
 

cd C:\xampplite\php
 
pear channel-update pear.php.net
 
pear channel-discover pear.symfony-project.com
pear install symfony/YAML
#pear upgrade symfony/YAML

pear channel-discover components.ez.no
pear install -a ezc/eZComponents
#pear upgrade ezc/eZComponents


 
pear channel-discover pear.phpunit.de
pear remote-list -c phpunit
pear install --alldeps phpunit/PHPUnit
#pear upgrade phpunit/PHPUnit

pear install PhpDocumentor
 
pear install Testing_Selenium-beta
 
pear install PHP_CodeSniffer
 
pear channel-discover pear.xplib.de
 
pear install xplib/PHP_CodeSniffer_Standards_EZC-beta
 
pear install phpunit/PHP_CodeBrowser
 

 
 
pear channel-discover pear.pdepend.org
 
 
pear install pdepend/PHP_Depend-beta
 
 
pear channel-discover pear.phpmd.org
 
pear install phpmd/PHP_PMD-alpha
 
pear install --alldeps phpunit/phpUnderControl

 http://sourceforge.net/projects/cruisecontrol/files/
 
 Install java jdk
 change the JAVA_HOME variable to C:\Program Files\Java\jdk1.6.0_17
 

Maybe it could be needed to copy jdk_home/lib/tools.jar to jre6_home/lib/ext
 
 
 Run using the Start menu the file cruisecontrol.bat
 
 phpuc install "C:\Program Files\CruiseControl"
 
 
 Close the cruisecontrol prompt and go to the Start menu and open it again.
 
 
 ########################
 Download Netbeans (PHP or Full)
 http://netbeans.org/downloads/index.html
 
 Change Netbeans language:
 
 Netbeans_Folder\etc
 
 Open "netbeans.conf", find the default options line:
 
 netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
 
Add "-J-Duser.language=en -J-Duser.region=US" to the end of line:
 

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m 
-J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none 
-J-Dapple.laf.useScreenMenuBar=true -J-Duser.language=en 
-J-Duser.region=US"

 
Open the Netbeans

 Tools->Options->PHP
 
 General
 PHP 5 Interpreter=C:\xampplite\php\php.exe
 UnitTesting
 PHPUnit Script: C:\xampplite\php\phpunit.bat
 
 
 ########################
 Download NBGit
 
 http://code.google.com/p/nbgit/
 
 Netbeans->Tools->Plugins->Download->Add Plugin
 
 Team->Git->Clone other
 
 http://github.com/ezsystems/ezpublish.git ( Only the benchmark and tests folder are important now )
 
 ###########################
 download netbeans php codesniffer
 
 http://github.com/beberlei/netbeans-php-enhancements/downloads/
 
 
 
 Tools->options->php->code sniffer->pear
 
 #################################
 
 available plugins
 
 selenium module for php
 
 #################################
 
 php md for netbeans ( I'm not sure if it is woking )
 
 
 http://sourceforge.net/projects/phpmdnb/
 
 Tool->options->misc->phpmd
 
 Using phpmd:

phpmd C:\xampplite\htdocs\ez\kernel\classes\ezaudit.php xml codesize,design,unusedcode,naming --reportfile C:\teste.xml

 
 ############################
 
 Using pdepend:

pdepend --summary-xml=/tmp/summary.xml \ 
 --jdepend-chart=/tmp/jdepend.svg \ --overview-pyramid=/tmp/pyramid.svg \
 /usr/local/share/pear/PHP/Depend

 
 
 ############################
 Download ez publish
 
 http://share.ez.no/download-develop
 
 C:\xampplite\htdocs
 
 extract ezpublishcommunity-4.4.0-with_ezc-gpl.tar.gz
 rename the folder ezpublish-4.4.0-with_ezc-gpl to ez
 

 Install it.

 
 
 #########
 
Running tests:

php bin/php/ezpgenerateautoloads.php -e
php tests/runtests.php extension/extfolder

BD testing

php tests/runtests.php -D mysql://root@localhost/ezpublish extension/extfolder

#########

Now you need to set up cruisecontrol to work with your project.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.