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.

eZ debug

Timing: Jan 18 2025 02:13:32
Script start
Timing: Jan 18 2025 02:13:32
Module start 'layout'
Timing: Jan 18 2025 02:13:32
Module start 'content'
Timing: Jan 18 2025 02:13:32
Module end 'content'
Timing: Jan 18 2025 02:13:32
Script end

Main resources:

Total runtime0.1241 sec
Peak memory usage6,144.0000 KB
Database Queries43

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.0703152.6406
Module start 'layout' 0.00480.0029 740.710939.4844
Module start 'content' 0.00770.1148 780.1953417.0469
Module end 'content' 0.12250.0015 1,197.242219.7031
Script end 0.1240  1,216.9453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00302.4360150.0002
Check MTime0.00121.0019150.0001
Mysql Total
Database connection0.00060.485210.0006
Mysqli_queries0.037730.3574430.0009
Looping result0.00030.2488410.0000
Template Total0.094976.520.0475
Template load0.00221.770420.0011
Template processing0.092774.716820.0464
Template load and register function0.00010.089510.0001
states
state_id_array0.00090.688310.0009
state_identifier_array0.00080.668120.0004
Override
Cache load0.00201.65091740.0000
Sytem overhead
Fetch class attribute name0.00262.063830.0009
class_abstraction
Instantiating content class attribute0.00000.008130.0000
General
dbfile0.00060.5232100.0001
String conversion0.00000.007340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplblog_entry/full.tplextension/community_design/design/suncana/override/templates/blog_entry/full.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
23content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
8content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezkeyword.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezkeyword.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 64
 Number of unique templates used: 9

Time used to render debug report: 0.0002 secs