eloquent/phpunit-extensions

This package is abandoned and no longer maintained. No replacement package was suggested.

Extensions for PHPUnit to provide additional functionality.

2.0.0 2014-02-17 09:49 UTC

This package is not auto-updated.

Last update: 2020-01-24 15:27:38 UTC


README

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.