-
Notifications
You must be signed in to change notification settings - Fork 150
/
RoboFile.php
82 lines (68 loc) · 1.73 KB
/
RoboFile.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
use Robo\Tasks;
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends Tasks
{
/**
* Default options for test tasks
*/
const DEFAULT_OPTIONS_TEST = [
'coverage' => false,
'dox' => false,
];
/**
* Run all test suites
*
* @param array $opts
* @option $dox Output agile documentation
* @option $coverage Generate test coverage report
*/
public function test($opts = self::DEFAULT_OPTIONS_TEST)
{
$task = $this->taskPHPUnit();
self::applyTestOptions($task, $opts);
$task->run();
}
/**
* Run unit tests
*
* @param array $opts
* @option $dox Output agile documentation
* @option $coverage Generate test coverage report
*/
public function testUnit($opts = self::DEFAULT_OPTIONS_TEST)
{
$task = $this->taskPHPUnit()
->option('testsuite', 'Unit');
self::applyTestOptions($task, $opts);
$task->run();
}
/**
* Run integration tests
*
* @param array $opts
* @option $dox Output agile documentation
* @option $coverage Generate test coverage report
*/
public function testIntegration($opts = self::DEFAULT_OPTIONS_TEST)
{
$task = $this->taskPHPUnit()
->option('testsuite', 'Integration');
self::applyTestOptions($task, $opts);
$task->run();
}
private function applyTestOptions($task, $opts)
{
if ($opts['dox']) {
$task->option('testdox');
}
if ($opts['coverage']) {
$task->option('coverage-html', './tests/coverage');
}
return $task;
}
}