1. Go to this page and download the library: Download task/phpunit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
task / phpunit example snippets
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('MyTest')
->setTestFile('MyTest.php')
->useColors()
->setBootstrap('bootstrap.php')
->setConfiguration('phpunit.xml')
->addCoverage('html')
->setIniValue('foo', 'bar')
->useDebug()
->setFilter('/foo/')
->setTestsuite('unit')
->addGroups(['foo', 'bar'])
->excludeGroups(['foo', 'bar'])
->addTestSuffixes(['.phpt', '.php'])
->setIncludePath('./src')
->setPrinter('MyPrinter')
bash
$> phpunit MyTest.php
bash
$> phpunit --bootstrap bootstrap.php
bash
$> phpunit --test-suffix .phpt,.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.