PHP Quality Assurance by Blaine Schmeisser
PHP Quality Assuranceby Blaine Schmeisser
Meme
Who am I?
● My name is Blaine Schmeisser● Using PHP about 10 years● Zend PHP Certification● Created multiple OS PHP QA tools
○ Mostly for Lithium (#li3)■ li3_quality■ Mocking / Stubbing classes (aspect oriented)■ Tons of new assertion methods
[email protected]@BlaineSch
github.com/BlaineSchBlaineSch.com
[email protected]/BlaineSch
BlaineSch.com@BlaineSch
My code keeps breaking?
● Standard UT Framework● Lots of Assertions● Mocking / Stubbing● Easy to extend
○ Plugins○ Custom Assertions
● Lots of Plugins○ Jenkins
What about browser testing?
● User Stories○ Similar to Ruby's Cucumber
● Multiple Browsers○ Goutte○ Selenium○ WebDriver○ Sahi○ Zombie
How do I mock a file system?
● Pseudo-file system that lives in memory● No need to modify your code● No need to give your CI server extra file
permissions.
vfs:://Stream
How do I debug my code?
● Breakpoints● Walkthrough● Runtime changes● Dynamic Code Analysis
○ Code Coverage○ Code Complexity
● Plugins for Popular Editors○ Vim○ Sublime○ PHPStorm○ ...more
I can tell who wrote what code just by looking at it.
● Static Code Analysis● Per-project Standards● Define Custom Standards● Configure Existing Standards● Use with your CI Server (Jenkins/Travis)
○ Guarantee standards on pull requests
PHP CodeSniffer
Meme
What does this code do?
● Short/long descriptions● Examples of how to use it● Link to code/web● Param types, names, and descriptions● Return type and description● Gen in various formats
○ Searchable!● ...more!
I'm writing a ton of code.
● Use a framework○ Lithium (#li3)○ Zend Framework 2 (#zf2)○ Symfony 2○ WordPress
● Use Modules and Plugins○ Composer○ Packagist.org
Links!PHPUnit
https://github.com/sebastianbergmann/phpunit/vfsStream
https://github.com/mikey179/vfsStreamBehat
https://github.com/Behat/BehatPHP CodeSniffer
https://github.com/squizlabs/PHP_CodeSnifferXdebug
https://github.com/xdebug/xdebugLithium
https://github.com/UnionOfRADZend Framework 2
https://github.com/zendframework/zf2Symfony 2
https://github.com/symfony/symfonyComposer
https://github.com/composer/composer