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\PrintedInterface; |
||
6 | use Robo\Exception\TaskException; |
||
7 | use Robo\Task\BaseTask; |
||
8 | use Robo\Contract\CommandInterface; |
||
9 | use Symfony\Component\Process\Process; |
||
10 | |||
11 | /** |
||
12 | * Executes Codeception tests |
||
13 | * |
||
14 | * ``` php |
||
15 | * <?php |
||
16 | * // config |
||
17 | * $this->taskCodecept() |
||
18 | * ->suite('acceptance') |
||
19 | * ->env('chrome') |
||
20 | * ->group('admin') |
||
21 | * ->xml() |
||
22 | * ->html() |
||
23 | * ->run(); |
||
24 | * |
||
25 | * ?> |
||
26 | * ``` |
||
27 | * |
||
28 | */ |
||
29 | class Codecept extends BaseTask implements CommandInterface, PrintedInterface |
||
30 | { |
||
31 | use \Robo\Common\ExecOneCommand; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $command; |
||
37 | protected $providedPathToCodeception; |
||
38 | |||
39 | /** |
||
40 | * @param string $pathToCodeception |
||
41 | * |
||
42 | * @throws \Robo\Exception\TaskException |
||
43 | */ |
||
44 | public function __construct($pathToCodeception = '') |
||
45 | { |
||
46 | $this->providedPathToCodeception = $pathToCodeception; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param string $suite |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function suite($suite) |
||
55 | { |
||
56 | $this->option(null, $suite); |
||
57 | return $this; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param string $testName |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function test($testName) |
||
66 | { |
||
67 | $this->option(null, $testName); |
||
68 | return $this; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * set group option. Can be called multiple times |
||
73 | * |
||
74 | * @param string $group |
||
75 | * |
||
76 | * @return $this |
||
77 | */ |
||
78 | public function group($group) |
||
79 | { |
||
80 | $this->option("group", $group); |
||
81 | return $this; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @param string $group |
||
86 | * |
||
87 | * @return $this |
||
88 | */ |
||
89 | public function excludeGroup($group) |
||
90 | { |
||
91 | $this->option("skip-group", $group); |
||
92 | return $this; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * generate json report |
||
97 | * |
||
98 | * @param string $file |
||
99 | * |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function json($file = null) |
||
103 | { |
||
104 | $this->option("json", $file); |
||
105 | return $this; |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * generate xml JUnit report |
||
110 | * |
||
111 | * @param string $file |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | public function xml($file = null) |
||
116 | { |
||
117 | $this->option("xml", $file); |
||
118 | return $this; |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * Generate html report |
||
123 | * |
||
124 | * @param string $dir |
||
125 | * |
||
126 | * @return $this |
||
127 | */ |
||
128 | public function html($dir = null) |
||
129 | { |
||
130 | $this->option("html", $dir); |
||
131 | return $this; |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * generate tap report |
||
136 | * |
||
137 | * @param string $file |
||
138 | * |
||
139 | * @return $this |
||
140 | */ |
||
141 | public function tap($file = null) |
||
142 | { |
||
143 | $this->option("tap", $file); |
||
144 | return $this; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * provides config file other then default `codeception.yml` with `-c` option |
||
149 | * |
||
150 | * @param string $file |
||
151 | * |
||
152 | * @return $this |
||
153 | */ |
||
154 | public function configFile($file) |
||
155 | { |
||
156 | $this->option("-c", $file); |
||
157 | return $this; |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * collect codecoverage in raw format. You may pass name of cov file to save results |
||
162 | * |
||
163 | * @param null|string $cov |
||
164 | * |
||
165 | * @return $this |
||
166 | */ |
||
167 | public function coverage($cov = null) |
||
168 | { |
||
169 | $this->option("coverage", $cov); |
||
170 | return $this; |
||
171 | } |
||
172 | |||
173 | /** |
||
174 | * execute in silent mode |
||
175 | * |
||
176 | * @return $this |
||
177 | */ |
||
178 | public function silent() |
||
179 | { |
||
180 | $this->option("silent"); |
||
181 | return $this; |
||
182 | } |
||
183 | |||
184 | /** |
||
185 | * collect code coverage in xml format. You may pass name of xml file to save results |
||
186 | * |
||
187 | * @param string $xml |
||
188 | * |
||
189 | * @return $this |
||
190 | */ |
||
191 | public function coverageXml($xml = null) |
||
192 | { |
||
193 | $this->option("coverage-xml", $xml); |
||
194 | return $this; |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * collect code coverage and generate html report. You may pass |
||
199 | * |
||
200 | * @param string $html |
||
201 | * |
||
202 | * @return $this |
||
203 | */ |
||
204 | public function coverageHtml($html = null) |
||
205 | { |
||
206 | $this->option("coverage-html", $html); |
||
207 | return $this; |
||
208 | } |
||
209 | |||
210 | /** |
||
211 | * @param string $env |
||
212 | * |
||
213 | * @return $this |
||
214 | */ |
||
215 | public function env($env) |
||
216 | { |
||
217 | $this->option("env", $env); |
||
218 | return $this; |
||
219 | } |
||
220 | |||
221 | /** |
||
222 | * @return $this |
||
223 | */ |
||
224 | public function debug() |
||
225 | { |
||
226 | $this->option("debug"); |
||
227 | return $this; |
||
228 | } |
||
229 | |||
230 | /** |
||
231 | * @return $this |
||
232 | */ |
||
233 | public function noRebuild() |
||
234 | { |
||
235 | $this->option("no-rebuild"); |
||
236 | return $this; |
||
237 | } |
||
238 | |||
239 | /** |
||
240 | * @param string $failGroup |
||
241 | * @return $this |
||
242 | */ |
||
243 | public function failGroup($failGroup) |
||
244 | { |
||
245 | $this->option('override', "extensions: config: Codeception\\Extension\\RunFailed: fail-group: {$failGroup}"); |
||
246 | return $this; |
||
247 | } |
||
248 | |||
249 | /** |
||
250 | * {@inheritdoc} |
||
251 | */ |
||
252 | public function getCommand() |
||
253 | { |
||
254 | if (!$this->command) { |
||
255 | $this->command = $this->providedPathToCodeception; |
||
256 | if (!$this->command) { |
||
257 | $this->command = $this->findExecutable('codecept'); |
||
0 ignored issues
–
show
|
|||
258 | } |
||
259 | if (!$this->command) { |
||
0 ignored issues
–
show
The expression
$this->command of type string|false is loosely compared to false ; this is ambiguous if the string can be empty. You might want to explicitly use === false instead.
In PHP, under loose comparison (like For '' == false // true
'' == null // true
'ab' == false // false
'ab' == null // false
// It is often better to use strict comparison
'' === false // false
'' === null // false
![]() |
|||
260 | debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
||
261 | throw new TaskException(__CLASS__, "Neither composer nor phar installation of Codeception found."); |
||
262 | } |
||
263 | $this->command .= ' run'; |
||
264 | } |
||
265 | |||
266 | return $this->command . $this->arguments; |
||
267 | } |
||
268 | |||
269 | /** |
||
270 | * {@inheritdoc} |
||
271 | */ |
||
272 | public function run() |
||
273 | { |
||
274 | $command = $this->getCommand(); |
||
275 | $this->printTaskInfo('Executing {command}', ['command' => $command]); |
||
276 | return $this->executeCommand($command); |
||
277 | } |
||
278 | } |
||
279 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.