taskphp/phpunit

Repository files navigation

Build StatusCoverage Status

Install via Composer:

...
    "require-dev": {
        "task/phpunit": "~0.2"
    }
...
use Task\Plugin\PHPUnitPlugin;

$project->inject(function ($container) {
    $container['phpunit'] = new PHPUnitPlugin;
});

$project->addTask('phpunit', ['phpunit', function ($phpunit) {
    $phpunit->getCommand()
        ->useColors()
        ->setBootstrap('tests/bootstrap.php')
        ->pipe($this->getOutput());
}]);

Given:

$project->addTask('phpunit', ['phpunit', function ($phpunit) {
    $phpunit->getCommand()
    ...
->setTestCase('MyTest')
$> phpunit MyTest
->setTestFile('MyTest.php')
$> phpunit MyTest.php
->useColors()
$> phpunit --colors
->setBootstrap('bootstrap.php')
$> phpunit --bootstrap bootstrap.php
->setConfiguration('phpunit.xml')
$> phpunit --configuration phpunit.xml
->addCoverage('html')
$> phpunit --coverage-html
->setIniValue('foo', 'bar')
$> phpunit -d foo=bar
->useDebug()
$> phpunit --debug
->setFilter('/foo/')
$> phpunit --filter /foo/
->setTestsuite('unit')
$> phpunit --testsuite unit
->addGroups(['foo', 'bar'])
$> phpunit --group foo,bar
->excludeGroups(['foo', 'bar'])
$> phpunit --exclude-group foo,bar
->addTestSuffixes(['.phpt', '.php'])
$> phpunit --test-suffix .phpt,.php
->setIncludePath('./src')
$> phpunit --include-path ./src
->setPrinter('MyPrinter')
$> phpunit --printer MyPrinter

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages