task / phpunit
Task 的 PHPUnit 插件
v0.3.3
2014-07-27 13:19 UTC
Requires
- php: >=5.4.0
- phpunit/phpunit: ~4.0
- task/plugin: ~1.0
- task/process: ~0.2
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: 1.0.*@dev
- satooshi/php-coveralls: ~0.6
- task/phpspec: ~0.1
- task/task: ~0.1
This package is not auto-updated.
Last update: 2024-09-28 15:12:28 UTC
README
安装
通过 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()); }]);
用法
给定
$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