SlideShare a Scribd company logo
Improving QA on PHP
projects
Michelangelo van Dam
ZendCon2010, Santa Clara, CA (USA)
Michelangelo van Dam
• Independent Consultant
• Zend Certified Engineer (ZCE)
• President of PHPBenelux
What’s the benefit of QA?
• early detection of issues
• cleaner & consistent code
• knowledge about the codebase
• increase of confidence
Sebastian Bergmann
• QA expert
• wrote the tools
• speaker and inspirer
Usual Suspects
PHP_CodeSniffer
Example Code
• Zend Framework QuickStart app
- http://framework.zend.com/manual/en/learning.quickstart.intro.html
<VirtualHost *:80>
DocumentRoot /srv/www/quickstart/public
ServerName quickstart.local
ServerAdmin root@localhost
<Directory /srv/www/quickstart/public>
Options Indexes FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php
</Directory>
Alias /reports /srv/www/quickstart/reports
<Directory /srv/www/quickstart/reports>
Options Indexes FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php index.html
</Directory>
</VirtualHost>
VirtualHost Settings
Showtime
Syntax Checking
• PHPLint
- comes with PHP binary
- validates code for syntax errors
• Website
- http://www.icosaedro.it/phplint/
Demo PHPLint
Code Documentation
• PHPDocumentator
- creates automated API documentation
- based on inline code blocks
• Installation
- pear install PhpDocumentor
• Website
- http://www.phpdoc.org
Demo PHPDoc
Output PHPDoc
Coding Standards
• PHP_CodeSniffer
- sniffs for coding standard violations
- ensures code is clean and consistent
- using standard and custom coding standards
• Installation
- pear install PHP_CodeSniffer
• Website
- http://pear.php.net/package/PHP_CodeSniffer
Demo PHP_CodeSniffer
PHPCPD
• PHP Copy/Paste Detector
- detects code duplication
• Installation
- pear channel-discover pear.phpunit.de
- pear channel-discover components.ez.no
- pear install --alldeps phpunit/phpcpd
• Website
- http://github.com/sebastianbergmann/phpcpd
Demo PHPCPD
Output
Mess Detection
• PDepend & PHPMD
- detects code mess
• Installation
- pear channel-discover pear.pdepend.org
- pear install pdepend/PHP_Depend
- pear channel-discover pear.phpmd.org
- pear install phpmd/PHP_PMD
• Websites
- http://www.pdepend.org
- http://www.phpmd.org
Demo detecting mess
Output codesize
Output unused code
Unit Testing
• PHPUnit
- tests code on unit level
- includes database tests
- integrates well with many PHP frameworks
• Installation
- pear channel-discover pear.phpunit.de
- pear install phpunit/PHPUnit
• Website
- http://www.phpunit.de
See other presentation
http://slideshare.net/DragonBe/unit-testing-after-zf-18
Packaging
• Phar
- PHP Archive (equivalent of Java jar)
- compresses and collects like
- included in PHP build (as of PHP 5.3.0)
• Installation (before PHP 5.3.0)
- pecl install phar
• Website:
- http://php.net/phar
Code example
<?php
include_once ‘phar://MyApp.phar/path/to/Class.php’;
$application = new Class;
$application->run();
Usage
• libraries
• modules
• images
• plugins
• deployment
Automated builds
• Phing
- automated build tool
- like Apache Ant
- integrates well with other PHP tools
• Installation
- pear channel-discover pear.phing.info
- pear install phing/phing
• Website
- http://phing.info
build.xml
<?xml version="1.0"?>
<project name="zfqs" description="Zend Framework QuickStart" default="build" >
<target name="version">
<version releasetype="Bugfix" file="build.version" property="version.number"/>
</target>
<target name="phplint">
<mkdir dir="./reports/phplint" />
<phplint file="./application/models" haltonfailure="false" tofile="./reports/phplint/errors.txt"/>
</target>
<target name="pdepend">
<mkdir dir="./reports/pdepend" />
<copy file="./build_pdepend.html" tofile="./reports/pdepend/index.html" overwrite="true" />
<exec command="/usr/bin/pdepend
--summary-xml=./reports/pdepend/summary.xml
--jdepend-chart=./reports/pdepend/jdepend.svg
--overview-pyramid=./reports/pdepend/pyramid.svg
./application/models"
dir="./" />
</target>
<target name="phpmd">
<mkdir dir="./reports/phpmd" />
<exec command="/usr/bin/phpmd ./application/models html codesize --reportfile ./reports/phpmd/codesize.html" dir="./" />
<exec command="/usr/bin/phpmd ./application/models html unusedcode --reportfile ./reports/phpmd/unusedcode.html" dir="./" />
</target>
<target name="phpcs">
<mkdir dir="./reports/phpcs" />
<exec command="/usr/bin/phpcs -n --standard=Zend --report=summary ./application/models > ./reports/phpcs/summary.txt" dir="./" />
<exec command="/usr/bin/phpcs -n --standard=Zend --report=source ./application/models > ./reports/phpcs/source.txt" dir="./" />
<exec command="/usr/bin/phpcs -n --standard=Zend --report=checkstyle ./application/models > ./reports/phpcs/checkstyle.xml" dir="./" />
</target>
<target name="phpcpd">
<mkdir dir="./reports/phpcpd" />
<exec command="/usr/bin/phpcpd --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models" dir="./" />
</target>
<target name="phpdoc">
<mkdir dir="./reports/phpdoc" />
<exec command="phpdoc -d ./application/models -q -t ./reports/phpdoc -o HTML:frames:earthli" dir="./" />
</target>
<target name="build" depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc">
<echo msg="Finishing build process ${version.number}" />
</target>
</project>
project definition
<?xml version="1.0"?>
<project name="zfqs" description="Zend Framework QuickStart" default="build" >
…
</project>
target version
<target name="version">
<version releasetype="Bugfix"
file="build.version" property="version.number"/>
</target>
In file “build.version” we have the version number as the following sequence:
MAJOR.MINOR.BUGFIX (starting at 0.0.0)
target phplint
<target name="phplint">
<mkdir dir="./reports/phplint" />
<phplint file="./application/models"
haltonfailure="false" tofile="./reports/phplint/errors.txt"/>
</target>
target pdepend
<target name="pdepend">
<mkdir dir="./reports/pdepend" />
<copy file="./build_pdepend.html"
tofile="./reports/pdepend/index.html" overwrite="true" />
<exec command="/usr/bin/pdepend
--summary-xml=./reports/pdepend/summary.xml
--jdepend-chart=./reports/pdepend/jdepend.svg
--overview-pyramid=./reports/pdepend/pyramid.svg
./application/models"
dir="./" />
</target>
target phpmd
<target name="phpmd">
<mkdir dir="./reports/phpmd" />
<exec command="/usr/bin/phpmd ./application/models html codesize
--reportfile ./reports/phpmd/codesize.html" dir="./" />
<exec command="/usr/bin/phpmd ./application/models html unusedcode
--reportfile ./reports/phpmd/unusedcode.html" dir="./" />
</target>
target phpcs
<target name="phpcs">
<mkdir dir="./reports/phpcs" />
<exec command="/usr/bin/phpcs -n
--standard=Zend --report=summary
./application/models > ./reports/phpcs/summary.txt"
dir="./" />
<exec command="/usr/bin/phpcs -n
--standard=Zend --report=source
./application/models > ./reports/phpcs/source.txt"
dir="./" />
<exec command="/usr/bin/phpcs -n
--standard=Zend --report=checkstyle
./application/models > ./reports/phpcs/checkstyle.xml"
dir="./" />
</target>
target phpcpd
<target name="phpcpd">
<mkdir dir="./reports/phpcpd" />
<exec command="/usr/bin/phpcpd
--log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models"
dir="./" />
</target>
target phpdoc
<target name="phpdoc">
<mkdir dir="./reports/phpdoc" />
<exec command="phpdoc -d ./application/models -q
-t ./reports/phpdoc -o HTML:frames:earthli"
dir="./" />
</target>
target build
<target name="build"
depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc">
<echo msg="Finishing build process ${version.number}" />
</target>
Demo building all
Demo building target
Our reports section
Summary
PHP offers lots of tools
more consistent and clean code
automated process
• http://slideshare.net/DragonBe/improving-qa-on-php-
projects
• http://twitter.com/DragonBe
• http://facebook.com/DragonBe
• http://joind.in/2279
Questions
http://conference.phpbenelux.eu
Ad

Recommended

Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011
Michelangelo van Dam
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
Shahar Evron
 
Web-Performance
Web-Performance
Walter Ebert
 
Expressive Microservice Framework Blastoff
Expressive Microservice Framework Blastoff
Adam Culp
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
Michiel Rook
 
Intro to PhoneGap
Intro to PhoneGap
Jussi Pohjolainen
 
Build Automation of PHP Applications
Build Automation of PHP Applications
Pavan Kumar N
 
Diagnosing WordPress: What to do when things go wrong
Diagnosing WordPress: What to do when things go wrong
WordCamp Sydney
 
Ant vs Phing
Ant vs Phing
Manuel Baldassarri
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
Phing: Building with PHP
Phing: Building with PHP
hozn
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
Tom Brander
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
Mihail Irintchev
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterprise
Taylor Lovett
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
Clark Everetts
 
Deploying PHP applications with Phing
Deploying PHP applications with Phing
Michiel Rook
 
Putting Phing to Work for You
Putting Phing to Work for You
hozn
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
Michiel Rook
 
Hey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the Problem
ColdFusionConference
 
Php 7 evolution
Php 7 evolution
Félix Gómez López
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
Michiel Rook
 
Phing
Phing
mdekrijger
 
Django Documentation
Django Documentation
Ying wei (Joe) Chou
 
Nightwatch at Tilt
Nightwatch at Tilt
Dave King
 
淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)
Kyle Lin
 
Continuous Integration Testing in Django
Continuous Integration Testing in Django
Kevin Harvey
 
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Kazuaki Matsuo
 
Automated Deployment With Phing
Automated Deployment With Phing
Daniel Cousineau
 
Php Power Tools
Php Power Tools
Michelangelo van Dam
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
Michelangelo van Dam
 

More Related Content

What's hot (20)

Ant vs Phing
Ant vs Phing
Manuel Baldassarri
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
Phing: Building with PHP
Phing: Building with PHP
hozn
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
Tom Brander
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
Mihail Irintchev
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterprise
Taylor Lovett
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
Clark Everetts
 
Deploying PHP applications with Phing
Deploying PHP applications with Phing
Michiel Rook
 
Putting Phing to Work for You
Putting Phing to Work for You
hozn
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
Michiel Rook
 
Hey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the Problem
ColdFusionConference
 
Php 7 evolution
Php 7 evolution
Félix Gómez López
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
Michiel Rook
 
Phing
Phing
mdekrijger
 
Django Documentation
Django Documentation
Ying wei (Joe) Chou
 
Nightwatch at Tilt
Nightwatch at Tilt
Dave King
 
淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)
Kyle Lin
 
Continuous Integration Testing in Django
Continuous Integration Testing in Django
Kevin Harvey
 
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Kazuaki Matsuo
 
Automated Deployment With Phing
Automated Deployment With Phing
Daniel Cousineau
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
Phing: Building with PHP
Phing: Building with PHP
hozn
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
Tom Brander
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
Mihail Irintchev
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterprise
Taylor Lovett
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
Clark Everetts
 
Deploying PHP applications with Phing
Deploying PHP applications with Phing
Michiel Rook
 
Putting Phing to Work for You
Putting Phing to Work for You
hozn
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
Michiel Rook
 
Hey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the Problem
ColdFusionConference
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
Michiel Rook
 
Nightwatch at Tilt
Nightwatch at Tilt
Dave King
 
淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)
Kyle Lin
 
Continuous Integration Testing in Django
Continuous Integration Testing in Django
Kevin Harvey
 
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Kazuaki Matsuo
 
Automated Deployment With Phing
Automated Deployment With Phing
Daniel Cousineau
 

Similar to Improving qa on php projects (20)

Php Power Tools
Php Power Tools
Michelangelo van Dam
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
Michelangelo van Dam
 
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
Michelangelo van Dam
 
Professional PHP: an open-source alternative for enterprise development [Kort...
Professional PHP: an open-source alternative for enterprise development [Kort...
Combell NV
 
An introduction to Phing the PHP build system (PHPDay, May 2012)
An introduction to Phing the PHP build system (PHPDay, May 2012)
Jeremy Coates
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Workshop quality assurance for php projects - phpdublin
Workshop quality assurance for php projects - phpdublin
Michelangelo van Dam
 
Professional PHP: an open-source alternative for enterprise development [Antw...
Professional PHP: an open-source alternative for enterprise development [Antw...
Combell NV
 
An introduction to Phing the PHP build system
An introduction to Phing the PHP build system
Jeremy Coates
 
PHP Industrialization
PHP Industrialization
Damien Seguy
 
PHP QA Tools
PHP QA Tools
rjsmelo
 
20 PHP Static Analysis and Documentation Generators #burningkeyboards
20 PHP Static Analysis and Documentation Generators #burningkeyboards
Denis Ristic
 
Best Practices with Zend Framework - Matthew Weier O'Phinney
Best Practices with Zend Framework - Matthew Weier O'Phinney
dpc
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBenelux
Nick Belhomme
 
Some Very Useful PHP Tools
Some Very Useful PHP Tools
Sem Jacobs
 
Microsoft TechDays 2011 - PHP on Windows
Microsoft TechDays 2011 - PHP on Windows
Enterprise PHP Center
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
Michelangelo van Dam
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)
dpc
 
Enterprise PHP Development - ZendCon 2008
Enterprise PHP Development - ZendCon 2008
Ivo Jansch
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
Michelangelo van Dam
 
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
Michelangelo van Dam
 
Professional PHP: an open-source alternative for enterprise development [Kort...
Professional PHP: an open-source alternative for enterprise development [Kort...
Combell NV
 
An introduction to Phing the PHP build system (PHPDay, May 2012)
An introduction to Phing the PHP build system (PHPDay, May 2012)
Jeremy Coates
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Workshop quality assurance for php projects - phpdublin
Workshop quality assurance for php projects - phpdublin
Michelangelo van Dam
 
Professional PHP: an open-source alternative for enterprise development [Antw...
Professional PHP: an open-source alternative for enterprise development [Antw...
Combell NV
 
An introduction to Phing the PHP build system
An introduction to Phing the PHP build system
Jeremy Coates
 
PHP Industrialization
PHP Industrialization
Damien Seguy
 
PHP QA Tools
PHP QA Tools
rjsmelo
 
20 PHP Static Analysis and Documentation Generators #burningkeyboards
20 PHP Static Analysis and Documentation Generators #burningkeyboards
Denis Ristic
 
Best Practices with Zend Framework - Matthew Weier O'Phinney
Best Practices with Zend Framework - Matthew Weier O'Phinney
dpc
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBenelux
Nick Belhomme
 
Some Very Useful PHP Tools
Some Very Useful PHP Tools
Sem Jacobs
 
Microsoft TechDays 2011 - PHP on Windows
Microsoft TechDays 2011 - PHP on Windows
Enterprise PHP Center
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
Michelangelo van Dam
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)
dpc
 
Enterprise PHP Development - ZendCon 2008
Enterprise PHP Development - ZendCon 2008
Ivo Jansch
 
Ad

More from Michelangelo van Dam (20)

GDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
Moving from app services to azure functions
Moving from app services to azure functions
Michelangelo van Dam
 
Privacy by design
Privacy by design
Michelangelo van Dam
 
DevOps or DevSecOps
DevOps or DevSecOps
Michelangelo van Dam
 
Privacy by design
Privacy by design
Michelangelo van Dam
 
Continuous deployment 2.0
Continuous deployment 2.0
Michelangelo van Dam
 
Let your tests drive your code
Let your tests drive your code
Michelangelo van Dam
 
General Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
The road to php 7.1
The road to php 7.1
Michelangelo van Dam
 
Open source for a successful business
Open source for a successful business
Michelangelo van Dam
 
Decouple your framework now, thank me later
Decouple your framework now, thank me later
Michelangelo van Dam
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
Azure and OSS, a match made in heaven
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
Getting hands dirty with php7
Getting hands dirty with php7
Michelangelo van Dam
 
Zf2 how arrays will save your project
Zf2 how arrays will save your project
Michelangelo van Dam
 
Create, test, secure, repeat
Create, test, secure, repeat
Michelangelo van Dam
 
The Continuous PHP Pipeline
The Continuous PHP Pipeline
Michelangelo van Dam
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Michelangelo van Dam
 
GDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
Moving from app services to azure functions
Moving from app services to azure functions
Michelangelo van Dam
 
General Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
Open source for a successful business
Open source for a successful business
Michelangelo van Dam
 
Decouple your framework now, thank me later
Decouple your framework now, thank me later
Michelangelo van Dam
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
Azure and OSS, a match made in heaven
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
Zf2 how arrays will save your project
Zf2 how arrays will save your project
Michelangelo van Dam
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
Easily extend your existing php app with an api
Easily extend your existing php app with an api
Michelangelo van Dam
 
Ad

Recently uploaded (20)

Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 

Improving qa on php projects

  • 1. Improving QA on PHP projects Michelangelo van Dam ZendCon2010, Santa Clara, CA (USA)
  • 2. Michelangelo van Dam • Independent Consultant • Zend Certified Engineer (ZCE) • President of PHPBenelux
  • 3. What’s the benefit of QA? • early detection of issues • cleaner & consistent code • knowledge about the codebase • increase of confidence
  • 4. Sebastian Bergmann • QA expert • wrote the tools • speaker and inspirer
  • 6. Example Code • Zend Framework QuickStart app - http://framework.zend.com/manual/en/learning.quickstart.intro.html
  • 7. <VirtualHost *:80> DocumentRoot /srv/www/quickstart/public ServerName quickstart.local ServerAdmin root@localhost <Directory /srv/www/quickstart/public> Options Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.php </Directory> Alias /reports /srv/www/quickstart/reports <Directory /srv/www/quickstart/reports> Options Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.php index.html </Directory> </VirtualHost> VirtualHost Settings
  • 9. Syntax Checking • PHPLint - comes with PHP binary - validates code for syntax errors • Website - http://www.icosaedro.it/phplint/
  • 11. Code Documentation • PHPDocumentator - creates automated API documentation - based on inline code blocks • Installation - pear install PhpDocumentor • Website - http://www.phpdoc.org
  • 14. Coding Standards • PHP_CodeSniffer - sniffs for coding standard violations - ensures code is clean and consistent - using standard and custom coding standards • Installation - pear install PHP_CodeSniffer • Website - http://pear.php.net/package/PHP_CodeSniffer
  • 16. PHPCPD • PHP Copy/Paste Detector - detects code duplication • Installation - pear channel-discover pear.phpunit.de - pear channel-discover components.ez.no - pear install --alldeps phpunit/phpcpd • Website - http://github.com/sebastianbergmann/phpcpd
  • 19. Mess Detection • PDepend & PHPMD - detects code mess • Installation - pear channel-discover pear.pdepend.org - pear install pdepend/PHP_Depend - pear channel-discover pear.phpmd.org - pear install phpmd/PHP_PMD • Websites - http://www.pdepend.org - http://www.phpmd.org
  • 23. Unit Testing • PHPUnit - tests code on unit level - includes database tests - integrates well with many PHP frameworks • Installation - pear channel-discover pear.phpunit.de - pear install phpunit/PHPUnit • Website - http://www.phpunit.de
  • 25. Packaging • Phar - PHP Archive (equivalent of Java jar) - compresses and collects like - included in PHP build (as of PHP 5.3.0) • Installation (before PHP 5.3.0) - pecl install phar • Website: - http://php.net/phar
  • 27. Usage • libraries • modules • images • plugins • deployment
  • 28. Automated builds • Phing - automated build tool - like Apache Ant - integrates well with other PHP tools • Installation - pear channel-discover pear.phing.info - pear install phing/phing • Website - http://phing.info
  • 29. build.xml <?xml version="1.0"?> <project name="zfqs" description="Zend Framework QuickStart" default="build" > <target name="version"> <version releasetype="Bugfix" file="build.version" property="version.number"/> </target> <target name="phplint"> <mkdir dir="./reports/phplint" /> <phplint file="./application/models" haltonfailure="false" tofile="./reports/phplint/errors.txt"/> </target> <target name="pdepend"> <mkdir dir="./reports/pdepend" /> <copy file="./build_pdepend.html" tofile="./reports/pdepend/index.html" overwrite="true" /> <exec command="/usr/bin/pdepend --summary-xml=./reports/pdepend/summary.xml --jdepend-chart=./reports/pdepend/jdepend.svg --overview-pyramid=./reports/pdepend/pyramid.svg ./application/models" dir="./" /> </target> <target name="phpmd"> <mkdir dir="./reports/phpmd" /> <exec command="/usr/bin/phpmd ./application/models html codesize --reportfile ./reports/phpmd/codesize.html" dir="./" /> <exec command="/usr/bin/phpmd ./application/models html unusedcode --reportfile ./reports/phpmd/unusedcode.html" dir="./" /> </target> <target name="phpcs"> <mkdir dir="./reports/phpcs" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=summary ./application/models > ./reports/phpcs/summary.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=source ./application/models > ./reports/phpcs/source.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=checkstyle ./application/models > ./reports/phpcs/checkstyle.xml" dir="./" /> </target> <target name="phpcpd"> <mkdir dir="./reports/phpcpd" /> <exec command="/usr/bin/phpcpd --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models" dir="./" /> </target> <target name="phpdoc"> <mkdir dir="./reports/phpdoc" /> <exec command="phpdoc -d ./application/models -q -t ./reports/phpdoc -o HTML:frames:earthli" dir="./" /> </target> <target name="build" depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc"> <echo msg="Finishing build process ${version.number}" /> </target> </project>
  • 30. project definition <?xml version="1.0"?> <project name="zfqs" description="Zend Framework QuickStart" default="build" > … </project>
  • 31. target version <target name="version"> <version releasetype="Bugfix" file="build.version" property="version.number"/> </target> In file “build.version” we have the version number as the following sequence: MAJOR.MINOR.BUGFIX (starting at 0.0.0)
  • 32. target phplint <target name="phplint"> <mkdir dir="./reports/phplint" /> <phplint file="./application/models" haltonfailure="false" tofile="./reports/phplint/errors.txt"/> </target>
  • 33. target pdepend <target name="pdepend"> <mkdir dir="./reports/pdepend" /> <copy file="./build_pdepend.html" tofile="./reports/pdepend/index.html" overwrite="true" /> <exec command="/usr/bin/pdepend --summary-xml=./reports/pdepend/summary.xml --jdepend-chart=./reports/pdepend/jdepend.svg --overview-pyramid=./reports/pdepend/pyramid.svg ./application/models" dir="./" /> </target>
  • 34. target phpmd <target name="phpmd"> <mkdir dir="./reports/phpmd" /> <exec command="/usr/bin/phpmd ./application/models html codesize --reportfile ./reports/phpmd/codesize.html" dir="./" /> <exec command="/usr/bin/phpmd ./application/models html unusedcode --reportfile ./reports/phpmd/unusedcode.html" dir="./" /> </target>
  • 35. target phpcs <target name="phpcs"> <mkdir dir="./reports/phpcs" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=summary ./application/models > ./reports/phpcs/summary.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=source ./application/models > ./reports/phpcs/source.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=checkstyle ./application/models > ./reports/phpcs/checkstyle.xml" dir="./" /> </target>
  • 36. target phpcpd <target name="phpcpd"> <mkdir dir="./reports/phpcpd" /> <exec command="/usr/bin/phpcpd --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models" dir="./" /> </target>
  • 37. target phpdoc <target name="phpdoc"> <mkdir dir="./reports/phpdoc" /> <exec command="phpdoc -d ./application/models -q -t ./reports/phpdoc -o HTML:frames:earthli" dir="./" /> </target>
  • 42. Summary PHP offers lots of tools more consistent and clean code automated process
  • 43. • http://slideshare.net/DragonBe/improving-qa-on-php- projects • http://twitter.com/DragonBe • http://facebook.com/DragonBe • http://joind.in/2279 Questions