1 | <?php |
||
7 | class Runner extends BaseRunner |
||
8 | { |
||
9 | /** |
||
10 | * A collection of available tokens based on the number |
||
11 | * of processes specified in $options. |
||
12 | * |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $tokens = []; |
||
16 | |||
17 | 8 | public function __construct($opts = []) |
|
22 | |||
23 | /** |
||
24 | * The money maker. Runs all ExecutableTest objects in separate processes. |
||
25 | */ |
||
26 | 2 | public function run() |
|
42 | |||
43 | /** |
||
44 | * Finalizes the run process. This method |
||
45 | * prints all results, rewinds the log interpreter, |
||
46 | * logs any results to JUnit, and cleans up temporary |
||
47 | * files. |
||
48 | */ |
||
49 | 2 | private function complete() |
|
60 | |||
61 | /** |
||
62 | * This method removes ExecutableTest objects from the pending collection |
||
63 | * and adds them to the running collection. It is also in charge of recycling and |
||
64 | * acquiring available test tokens for use. |
||
65 | */ |
||
66 | 2 | private function fillRunQueue() |
|
78 | |||
79 | /** |
||
80 | * Returns whether or not a test has finished being |
||
81 | * executed. If it has, this method also halts a test process - optionally |
||
82 | * throwing an exception if a fatal error has occurred - |
||
83 | * prints feedback, and updates the overall exit code. |
||
84 | * |
||
85 | * @param ExecutableTest $test |
||
86 | * |
||
87 | * @throws \Exception |
||
88 | * |
||
89 | * @return bool |
||
90 | */ |
||
91 | 2 | private function testIsStillRunning($test) |
|
92 | { |
||
93 | 2 | if (!$test->isDoneRunning()) { |
|
94 | 2 | return true; |
|
95 | } |
||
96 | 2 | $this->setExitCode($test); |
|
97 | 2 | $test->stop(); |
|
98 | 2 | if ($this->options->stopOnFailure && $test->getExitCode() > 0) { |
|
99 | $this->pending = []; |
||
100 | } |
||
101 | 2 | if (static::PHPUNIT_FATAL_ERROR === $test->getExitCode()) { |
|
102 | $errorOutput = $test->getStderr(); |
||
103 | if (!$errorOutput) { |
||
104 | $errorOutput = $test->getStdout(); |
||
105 | } |
||
106 | throw new \Exception($errorOutput); |
||
107 | } |
||
108 | 2 | $this->printer->printFeedback($test); |
|
109 | 2 | if ($this->hasCoverage()) { |
|
110 | 2 | $this->addCoverage($test); |
|
111 | } |
||
112 | |||
113 | 2 | return false; |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * If the provided test object has an exit code |
||
118 | * higher than the currently set exit code, that exit |
||
119 | * code will be set as the overall exit code. |
||
120 | * |
||
121 | * @param ExecutableTest $test |
||
122 | */ |
||
123 | 2 | private function setExitCode(ExecutableTest $test) |
|
130 | |||
131 | /** |
||
132 | * Initialize the available test tokens based |
||
133 | * on how many processes ParaTest will be run in. |
||
134 | */ |
||
135 | 8 | protected function initTokens() |
|
142 | |||
143 | /** |
||
144 | * Gets the next token that is available to be acquired |
||
145 | * from a finished process. |
||
146 | * |
||
147 | * @return bool|array |
||
148 | */ |
||
149 | 4 | protected function getNextAvailableToken() |
|
159 | |||
160 | /** |
||
161 | * Flag a token as available for use. |
||
162 | * |
||
163 | * @param string $tokenIdentifier |
||
164 | */ |
||
165 | 3 | protected function releaseToken($tokenIdentifier) |
|
173 | |||
174 | /** |
||
175 | * Flag a token as acquired and not available for use. |
||
176 | * |
||
177 | * @param string $tokenIdentifier |
||
178 | */ |
||
179 | protected function acquireToken($tokenIdentifier) |
||
187 | |||
188 | /** |
||
189 | * @param ExecutableTest $test |
||
190 | */ |
||
191 | 2 | private function addCoverage(ExecutableTest $test) |
|
196 | } |
||
197 |
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.