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 | declare(strict_types=1); |
||
4 | |||
5 | namespace ParaTest\Runners\PHPUnit; |
||
6 | |||
7 | use ParaTest\Coverage\CoverageMerger; |
||
8 | use ParaTest\Logging\JUnit\Writer; |
||
9 | use ParaTest\Logging\LogInterpreter; |
||
10 | |||
11 | abstract class BaseRunner |
||
12 | { |
||
13 | const PHPUNIT_FATAL_ERROR = 255; |
||
14 | |||
15 | /** |
||
16 | * @var Options |
||
17 | */ |
||
18 | protected $options; |
||
19 | |||
20 | /** |
||
21 | * @var \ParaTest\Logging\LogInterpreter |
||
22 | */ |
||
23 | protected $interpreter; |
||
24 | |||
25 | /** |
||
26 | * @var ResultPrinter |
||
27 | */ |
||
28 | protected $printer; |
||
29 | |||
30 | /** |
||
31 | * A collection of pending ExecutableTest objects that have |
||
32 | * yet to run. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $pending = []; |
||
37 | |||
38 | /** |
||
39 | * A collection of ExecutableTest objects that have processes |
||
40 | * currently running. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $running = []; |
||
45 | |||
46 | /** |
||
47 | * A tallied exit code that returns the highest exit |
||
48 | * code returned out of the entire collection of tests. |
||
49 | * |
||
50 | * @var int |
||
51 | */ |
||
52 | protected $exitcode = -1; |
||
53 | |||
54 | /** |
||
55 | * CoverageMerger to hold track of the accumulated coverage. |
||
56 | * |
||
57 | * @var CoverageMerger |
||
58 | */ |
||
59 | protected $coverage = null; |
||
60 | |||
61 | 8 | public function __construct(array $opts = []) |
|
62 | { |
||
63 | 8 | $this->options = new Options($opts); |
|
64 | 8 | $this->interpreter = new LogInterpreter(); |
|
65 | 8 | $this->printer = new ResultPrinter($this->interpreter); |
|
66 | 8 | } |
|
67 | |||
68 | 2 | public function run() |
|
69 | { |
||
70 | 2 | $this->verifyConfiguration(); |
|
71 | 2 | $this->initCoverage(); |
|
72 | 2 | $this->load(); |
|
73 | 2 | $this->printer->start($this->options); |
|
74 | 2 | } |
|
75 | |||
76 | /** |
||
77 | * Ensures a valid configuration was supplied. If not |
||
78 | * causes ParaTest to print the error message and exit immediately |
||
79 | * with an exit code of 1. |
||
80 | */ |
||
81 | 2 | protected function verifyConfiguration() |
|
82 | { |
||
83 | 2 | if (isset($this->options->filtered['configuration']) && !file_exists($this->options->filtered['configuration']->getPath())) { |
|
0 ignored issues
–
show
|
|||
84 | $this->printer->println(sprintf('Could not read "%s".', $this->options->filtered['configuration'])); |
||
0 ignored issues
–
show
The property
$filtered is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
85 | exit(1); |
||
86 | } |
||
87 | 2 | } |
|
88 | |||
89 | /** |
||
90 | * Builds the collection of pending ExecutableTest objects |
||
91 | * to run. If functional mode is enabled $this->pending will |
||
92 | * contain a collection of TestMethod objects instead of Suite |
||
93 | * objects. |
||
94 | */ |
||
95 | 2 | protected function load() |
|
96 | { |
||
97 | 2 | $loader = new SuiteLoader($this->options); |
|
98 | 2 | $loader->load($this->options->path); |
|
0 ignored issues
–
show
The property
$path is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
99 | 2 | $executables = $this->options->functional ? $loader->getTestMethods() : $loader->getSuites(); |
|
0 ignored issues
–
show
The property
$functional is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
100 | 2 | $this->pending = array_merge($this->pending, $executables); |
|
101 | 2 | foreach ($this->pending as $pending) { |
|
102 | 2 | $this->printer->addTest($pending); |
|
103 | } |
||
104 | 2 | } |
|
105 | |||
106 | /** |
||
107 | * Returns the highest exit code encountered |
||
108 | * throughout the course of test execution. |
||
109 | * |
||
110 | * @return int |
||
111 | */ |
||
112 | 1 | public function getExitCode(): int |
|
113 | { |
||
114 | 1 | return $this->exitcode; |
|
115 | } |
||
116 | |||
117 | /** |
||
118 | * Write output to JUnit format if requested. |
||
119 | */ |
||
120 | 2 | protected function log() |
|
121 | { |
||
122 | 2 | if (!isset($this->options->filtered['log-junit'])) { |
|
0 ignored issues
–
show
The property
$filtered is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
123 | 1 | return; |
|
124 | } |
||
125 | 1 | $output = $this->options->filtered['log-junit']; |
|
0 ignored issues
–
show
The property
$filtered is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
126 | 1 | $writer = new Writer($this->interpreter, $this->options->path); |
|
0 ignored issues
–
show
The property
$path is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
127 | 1 | $writer->write($output); |
|
128 | 1 | } |
|
129 | |||
130 | /** |
||
131 | * Write coverage to file if requested. |
||
132 | */ |
||
133 | 2 | protected function logCoverage() |
|
134 | { |
||
135 | 2 | if (!$this->hasCoverage()) { |
|
136 | return; |
||
137 | } |
||
138 | |||
139 | 2 | $filteredOptions = $this->options->filtered; |
|
0 ignored issues
–
show
The property
$filtered is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
140 | |||
141 | 2 | $reporter = $this->getCoverage()->getReporter(); |
|
142 | |||
143 | 2 | if (isset($filteredOptions['coverage-clover'])) { |
|
144 | $reporter->clover($filteredOptions['coverage-clover']); |
||
145 | } |
||
146 | |||
147 | 2 | if (isset($filteredOptions['coverage-html'])) { |
|
148 | $reporter->html($filteredOptions['coverage-html']); |
||
149 | } |
||
150 | |||
151 | 2 | $reporter->php($filteredOptions['coverage-php']); |
|
152 | 2 | } |
|
153 | |||
154 | 2 | protected function initCoverage() |
|
155 | { |
||
156 | 2 | if (!isset($this->options->filtered['coverage-php'])) { |
|
0 ignored issues
–
show
The property
$filtered is declared protected in ParaTest\Runners\PHPUnit\Options . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
157 | return; |
||
158 | } |
||
159 | |||
160 | 2 | $this->coverage = new CoverageMerger(); |
|
161 | 2 | } |
|
162 | |||
163 | /** |
||
164 | * @return bool |
||
165 | */ |
||
166 | 2 | protected function hasCoverage(): bool |
|
167 | { |
||
168 | 2 | return $this->getCoverage() !== null; |
|
169 | } |
||
170 | |||
171 | /** |
||
172 | * @return CoverageMerger|null |
||
173 | */ |
||
174 | 2 | protected function getCoverage() |
|
175 | { |
||
176 | 2 | return $this->coverage; |
|
177 | } |
||
178 | } |
||
179 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.