This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Robo\Task\Testing; |
||
4 | |||
5 | use Robo\Contract\CommandInterface; |
||
6 | use Robo\Contract\PrintedInterface; |
||
7 | use Robo\Task\BaseTask; |
||
8 | |||
9 | /** |
||
10 | * Runs PHPUnit tests |
||
11 | * |
||
12 | * ``` php |
||
13 | * <?php |
||
14 | * $this->taskPHPUnit() |
||
15 | * ->group('core') |
||
16 | * ->bootstrap('test/bootstrap.php') |
||
17 | * ->run() |
||
18 | * |
||
19 | * ?> |
||
20 | * ``` |
||
21 | */ |
||
22 | class PHPUnit extends BaseTask implements CommandInterface, PrintedInterface |
||
23 | { |
||
24 | use \Robo\Common\ExecOneCommand; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $command; |
||
30 | |||
31 | /** |
||
32 | * Directory of test files or single test file to run. Appended to |
||
33 | * the command and arguments. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $files = ''; |
||
38 | |||
39 | /** |
||
40 | * PHPUnit constructor. |
||
41 | * |
||
42 | * @param null|string $pathToPhpUnit |
||
43 | * |
||
44 | * @throws \Robo\Exception\TaskException |
||
45 | */ |
||
46 | View Code Duplication | public function __construct($pathToPhpUnit = null) |
|
47 | { |
||
48 | $this->command = $pathToPhpUnit; |
||
49 | if (!$this->command) { |
||
50 | $this->command = $this->findExecutablePhar('phpunit'); |
||
51 | } |
||
52 | if (!$this->command) { |
||
53 | throw new \Robo\Exception\TaskException(__CLASS__, "Neither local phpunit nor global composer installation not found"); |
||
54 | } |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @param string $filter |
||
59 | * |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function filter($filter) |
||
63 | { |
||
64 | $this->option('filter', $filter); |
||
65 | return $this; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param string $group |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function group($group) |
||
74 | { |
||
75 | $this->option("group", $group); |
||
76 | return $this; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param string $group |
||
81 | * |
||
82 | * @return $this |
||
83 | */ |
||
84 | public function excludeGroup($group) |
||
85 | { |
||
86 | $this->option("exclude-group", $group); |
||
87 | return $this; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * adds `log-json` option to runner |
||
92 | * |
||
93 | * @param string $file |
||
94 | * |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function json($file = null) |
||
98 | { |
||
99 | $this->option("log-json", $file); |
||
100 | return $this; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * adds `log-junit` option |
||
105 | * |
||
106 | * @param string $file |
||
107 | * |
||
108 | * @return $this |
||
109 | */ |
||
110 | public function xml($file = null) |
||
111 | { |
||
112 | $this->option("log-junit", $file); |
||
113 | return $this; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * @param string $file |
||
118 | * |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function tap($file = "") |
||
122 | { |
||
123 | $this->option("log-tap", $file); |
||
124 | return $this; |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * @param string $file |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function bootstrap($file) |
||
133 | { |
||
134 | $this->option("bootstrap", $file); |
||
135 | return $this; |
||
136 | } |
||
137 | |||
138 | /** |
||
139 | * @param string $file |
||
140 | * |
||
141 | * @return $this |
||
142 | */ |
||
143 | public function configFile($file) |
||
144 | { |
||
145 | $this->option('-c', $file); |
||
146 | return $this; |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @return $this |
||
151 | */ |
||
152 | public function debug() |
||
153 | { |
||
154 | $this->option("debug"); |
||
155 | return $this; |
||
156 | } |
||
157 | |||
158 | /** |
||
159 | * Directory of test files or single test file to run. |
||
160 | * |
||
161 | * @param string $files |
||
162 | * A single test file or a directory containing test files. |
||
163 | * |
||
164 | * @return $this |
||
165 | * |
||
166 | * @throws \Robo\Exception\TaskException |
||
167 | * |
||
168 | * @deprecated Use file() or dir() method instead |
||
169 | */ |
||
170 | public function files($files) |
||
171 | { |
||
172 | if (!empty($this->files) || is_array($files)) { |
||
173 | throw new \Robo\Exception\TaskException(__CLASS__, "Only one file or directory may be provided."); |
||
174 | } |
||
175 | $this->files = ' ' . $files; |
||
176 | |||
177 | return $this; |
||
178 | } |
||
179 | |||
180 | /** |
||
181 | * Test the provided file. |
||
182 | * |
||
183 | * @param string $file |
||
184 | * Path to file to test. |
||
185 | * |
||
186 | * @return $this |
||
187 | */ |
||
188 | public function file($file) |
||
189 | { |
||
190 | return $this->files($file); |
||
0 ignored issues
–
show
|
|||
191 | } |
||
192 | |||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | public function getCommand() |
||
197 | { |
||
198 | return $this->command . $this->arguments . $this->files; |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * {@inheritdoc} |
||
203 | */ |
||
204 | public function run() |
||
205 | { |
||
206 | $this->printTaskInfo('Running PHPUnit {arguments}', ['arguments' => $this->arguments]); |
||
207 | return $this->executeCommand($this->getCommand()); |
||
208 | } |
||
209 | } |
||
210 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.