-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile
48 lines (37 loc) · 1.27 KB
/
Taskfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require 'vendor/autoload.php';
use Task\Plugin\PhpSpecPlugin;
use Task\Plugin\PHPUnitPlugin;
$project = new Task\Project('task/process');
$project->inject(function ($container) {
$container['phpspec'] = new PhpSpecPlugin;
$container['phpunit'] = new PHPUnitPlugin;
});
$project->addTask('phpspec', ['phpspec', function ($phpspec) {
$phpspec->command('run')
->setFormat('pretty')
->pipe($this->getOutput());
}]);
$project->addTask('phpunit', ['phpunit', function ($phpunit) {
$phpunit->getCommand()
->setBootstrap('vendor/autoload.php')
->setTestCase('tests/src')
->pipe($this->getOutput());
}]);
$project->addTask('test', function () {
$filter = new PHP_CodeCoverage_Filter;
$filter->addDirectoryToWhitelist(__DIR__.'/src');
$coverage = new PHP_CodeCoverage(null, $filter);
$coverage->start('task/process');
$this->runTask('phpunit');
$this->runTask('phpspec');
$coverage->stop();
$output = $this->getOutput();
$output->writeln('');
$output->writeln('Generating coverage...');
$html = new PHP_CodeCoverage_Report_HTML;
$html->process($coverage, 'coverage');
$clover = new PHP_CodeCoverage_Report_Clover;
$clover->process($coverage, 'coverage.xml');
});
return $project;