8 Must Have PHP Quality Assurance Tools

Posted by Unknown on Tuesday, June 24, 2014

Quality Assurance in PHP is a valuable but very rarely seen aspect. In a world focused on rapid deployment and a “ship now, worry later” mentality, a focus on quality is a rare sight, especially when dealing with the web. One of our authors recently directed my attention to Sebastian Bergmann’s site, PHP QA Tools.


The site is a simple list of interesting tools that can help you properly test your application, while also analyzing it and producing interesting data for you to look at. This post will be little more than a re-iteration of some of those tools with added information, use cases and advice about them - however, we’re open to expanding this list with other QA tools you throw our way that get plenty of votes in the comments below or seem interesting and/or useful enough.


1. PHPUnit


Mr. Bergmann’s own PHPUnit is, unsurprisingly, present on the list. PHPUnit is the most widely used and fully featured unit testing tool which we’ve covered extensively before - I believe it needs no further introduction.


PHPUnit can be installed globally, by running composer global require "phpunit/phpunit=4.1.*".


2. Behat


Behat, a BDD framework, is a framework which will be covered in great detail on our channel soon, but in a nutshell, it allows you to write highly readable feature tests - tests that can be easily understood by even non-technical people. They’re actual stories you write, in this form, as per their site:



Scenario: List 2 files in a directory
Given I am in a directory "test"
And I have a file named "foo"
And I have a file named "bar"
When I run "ls"
Then I should get:
"""
bar
foo
"""


You then write classes with methods which define the specific sentences, such as:



/** @Given /^I have a file named "([^"]*)"$/ */
public function iHaveAFileNamed($file)
{
touch
($file);
}


in which Behat automatically passes the argument into the function based on what you placed between the quotes.


Continue reading %8 Must Have PHP Quality Assurance Tools%




more

{ 0 comments... » 8 Must Have PHP Quality Assurance Tools read them below or add one }

Post a Comment

Popular Posts