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

More Related Content

What's hot

Ant vs Phing
Ant vs PhingAnt vs Phing
Ant vs Phing
Manuel Baldassarri
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011Bachkoutou Toutou
 
Phing: Building with PHP
Phing: Building with PHPPhing: Building with PHP
Phing: Building with PHP
hozn
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?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 phingBuilding and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
Mihail Irintchev
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterpriseTaylor Lovett
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstZend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstClark Everetts
 
Deploying PHP applications with Phing
Deploying PHP applications with PhingDeploying PHP applications with Phing
Deploying PHP applications with Phing
Michiel Rook
 
Putting Phing to Work for You
Putting Phing to Work for YouPutting 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)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 ProblemHey 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 evolutionPhp 7 evolution
Php 7 evolution
Félix Gómez López
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with PhingBuilding and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
Michiel Rook
 
Phing
PhingPhing
Phing
mdekrijger
 
Django Documentation
Django DocumentationDjango Documentation
Django Documentation
Ying wei (Joe) Chou
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
Dave King
 
淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)
Kyle Lin
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous 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)Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Kazuaki Matsuo
 
Automated Deployment With Phing
Automated Deployment With PhingAutomated Deployment With Phing
Automated Deployment With Phing
Daniel Cousineau
 

What's hot (20)

Ant vs Phing
Ant vs PhingAnt vs Phing
Ant vs Phing
 
Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011Zend Framework 2, What's new, Confoo 2011
Zend Framework 2, What's new, Confoo 2011
 
Phing: Building with PHP
Phing: Building with PHPPhing: Building with PHP
Phing: Building with PHP
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phingBuilding and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterprise
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstZend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
 
Deploying PHP applications with Phing
Deploying PHP applications with PhingDeploying PHP applications with Phing
Deploying PHP applications with Phing
 
Putting Phing to Work for You
Putting Phing to Work for YouPutting Phing to Work for You
Putting Phing to Work for You
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
 
Hey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the ProblemHey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the Problem
 
Php 7 evolution
Php 7 evolutionPhp 7 evolution
Php 7 evolution
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with PhingBuilding and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
 
Phing
PhingPhing
Phing
 
Django Documentation
Django DocumentationDjango Documentation
Django Documentation
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)淺談 Geb 網站自動化測試(JCConf 2014)
淺談 Geb 網站自動化測試(JCConf 2014)
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)
 
Automated Deployment With Phing
Automated Deployment With PhingAutomated Deployment With Phing
Automated Deployment With Phing
 

Similar to Improving qa on php projects

Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
Michelangelo van Dam
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
DECK36
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Bastian Feder
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
Bipin Upadhyay
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
shah_neeraj
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
Francois Zaninotto
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
Zend by Rogue Wave Software
 
Sonar - the ring to rule them all
Sonar - the ring to rule them allSonar - the ring to rule them all
Sonar - the ring to rule them all
Sebastian Marek
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chefdefrag2
 
Evolution of deploy.sh
Evolution of deploy.shEvolution of deploy.sh
Evolution of deploy.sh
Leonid Mamchenkov
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings10n Software, LLC
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CI
Martin de Keijzer
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_companyGanesh Kulkarni
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
Steve Mortiboy
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Nathen Harvey
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
nhm taveer hossain khan
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
Ben Ramsey
 

Similar to Improving qa on php projects (20)

Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
 
Php Development Stack
Php Development StackPhp Development Stack
Php Development Stack
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Sonar - the ring to rule them all
Sonar - the ring to rule them allSonar - the ring to rule them all
Sonar - the ring to rule them all
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
 
Evolution of deploy.sh
Evolution of deploy.shEvolution of deploy.sh
Evolution of deploy.sh
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CI
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_company
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
 

More from Michelangelo van Dam

GDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and defaultGDPR 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 functionsMoving from app services to azure functions
Moving from app services to azure functions
Michelangelo van Dam
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
Michelangelo van Dam
 
DevOps or DevSecOps
DevOps or DevSecOpsDevOps or DevSecOps
DevOps or DevSecOps
Michelangelo van Dam
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
Michelangelo van Dam
 
Continuous deployment 2.0
Continuous deployment 2.0Continuous deployment 2.0
Continuous deployment 2.0
Michelangelo van Dam
 
Let your tests drive your code
Let your tests drive your codeLet 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 storyGeneral 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 advantageLeveraging 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.1The 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 businessOpen 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 laterDecouple 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 minutesDeploy 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 heavenAzure 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 php7Getting 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 projectZf2   how arrays will save your project
Zf2 how arrays will save your projectMichelangelo van Dam
 
Create, test, secure, repeat
Create, test, secure, repeatCreate, test, secure, repeat
Create, test, secure, repeat
Michelangelo van Dam
 
The Continuous PHP Pipeline
The Continuous PHP PipelineThe 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 testsPHPUnit 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 apiEasily extend your existing php app with an api
Easily extend your existing php app with an api
Michelangelo van Dam
 

More from Michelangelo van Dam (20)

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

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 

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