Skip to content

taskphp/phpunit

Repository files navigation

task/phpunit

Build Status Coverage Status

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 MyTest

setTestFile

->setTestFile('MyTest.php')
$> phpunit MyTest.php

useColors

->useColors()
$> phpunit --colors

setBootstrap

->setBootstrap('bootstrap.php')
$> phpunit --bootstrap bootstrap.php

setConfiguration

->setConfiguration('phpunit.xml')
$> phpunit --configuration phpunit.xml

addCoverage

->addCoverage('html')
$> phpunit --coverage-html

setInitValue

->setIniValue('foo', 'bar')
$> phpunit -d foo=bar

useDebug

->useDebug()
$> phpunit --debug

setFilter

->setFilter('/foo/')
$> phpunit --filter /foo/

setTestsuite

->setTestsuite('unit')
$> phpunit --testsuite unit

addGroups

->addGroups(['foo', 'bar'])
$> phpunit --group foo,bar

excludeGroups

->excludeGroups(['foo', 'bar'])
$> phpunit --exclude-group foo,bar

addTestSuffixes

->addTestSuffixes(['.phpt', '.php'])
$> phpunit --test-suffix .phpt,.php

setIncludePath

->setIncludePath('./src')
$> phpunit --include-path ./src

setPrinter

->setPrinter('MyPrinter')
$> phpunit --printer MyPrinter

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages