task/phpunit
Installation
Install via Composer:
...
"require-dev": {
"task/phpunit": "~0.2"
}
...Example
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());
}]);Usage
Given:
$project->addTask('phpunit', ['phpunit', function ($phpunit) {
$phpunit->getCommand()
...setTestCase
->setTestCase('MyTest')$> phpunit MyTestsetTestFile
->setTestFile('MyTest.php')$> phpunit MyTest.phpuseColors
->useColors()$> phpunit --colorssetBootstrap
->setBootstrap('bootstrap.php')$> phpunit --bootstrap bootstrap.phpsetConfiguration
->setConfiguration('phpunit.xml')$> phpunit --configuration phpunit.xmladdCoverage
->addCoverage('html')$> phpunit --coverage-htmlsetInitValue
->setIniValue('foo', 'bar')$> phpunit -d foo=baruseDebug
->useDebug()$> phpunit --debugsetFilter
->setFilter('/foo/')$> phpunit --filter /foo/setTestsuite
->setTestsuite('unit')$> phpunit --testsuite unitaddGroups
->addGroups(['foo', 'bar'])$> phpunit --group foo,barexcludeGroups
->excludeGroups(['foo', 'bar'])$> phpunit --exclude-group foo,baraddTestSuffixes
->addTestSuffixes(['.phpt', '.php'])$> phpunit --test-suffix .phpt,.phpsetIncludePath
->setIncludePath('./src')$> phpunit --include-path ./srcsetPrinter
->setPrinter('MyPrinter')$> phpunit --printer MyPrinter