Skip to content
This repository has been archived by the owner on Nov 21, 2017. It is now read-only.

Extensions for PHPUnit to provide additional functionality.

License

Notifications You must be signed in to change notification settings

eloquent/phpunit-extensions

Repository files navigation

PHPUnit extensions

Extensions for PHPUnit to provide additional functionality.

The most recent stable version is 2.0.0 Current build status image Current coverage status image

Installation and documentation

Parameterized test cases

Parameterized test cases allow entire PHPUnit test cases to be run in multiple different configurations. They operate similar to PHPUnit's own data providers, but on a test case level rather than a test method level.

To create a parameterized test case, extend the ParameterizedTestCase class instead of PHPUnit_Framework_TestCase, and implement the required methods:

use Eloquent\Phpunit\ParameterizedTestCase;

class ExampleTest extends ParameterizedTestCase
{
    public function getTestCaseParameters()
    {
        return array(
            array('Ocelot', 'Lapis lazuli', 'Dandelion'),
            array('Sloth', 'Carbon', 'Conifer'),
        );
    }

    public function setUpParameterized($animal, $mineral, $vegetable)
    {
        // set up...
    }

    public function tearDownParameterized($animal, $mineral, $vegetable)
    {
        // tear down...
    }

    public function testSomething()
    {
        // test...
    }
}

Every test in the testcase will now be run once for each entry in the getTestCaseParameters() method.

About

Extensions for PHPUnit to provide additional functionality.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages