8 Must Have PHP Quality Assurance Tools

For shipping quality code, we must have testing in mind while coding (if not doing TDD). However, with the wide range of PHP testing tools out there, it’s hard to make a choice! Exploring PHP is a fun adventure  but it’s hard to assemble a tool belt that’s not too heavy to wear to work!

This popular article will highlight the most popular testing tools and has been updated to reflect the state of QA tools in 2017.

 

PHP Unit

PHPUnit is the go to testing framework for PHP. It was created by Sebastian Bergmann in 2004 and current in version 6 that requires PHP 7.

 

Selenium

Selenium is a tool for automated browser testing (Integration and acceptance testing). It transforms the tests to browser API commands and it asserts the expected results. It supports most of the available browsers out there.

We can use Selenium with PHPUnit using an extension.

composer require --dev phpunit/phpunit
composer require --dev phpunit/phpunit-selenium

Here’s a simple example:

class UserSubscriptionTest extends PHPUnit_Extensions_Selenium2TestCase
{
    public function testFormSubmissionWithUsername()
    {
        $this->byName('username')->value('name');
        $this->byId('subscriptionForm')->submit();
    }
}

	



Leave a Reply

Your email address will not be published. Required fields are marked *