|
26 | 26 |
|
27 | 27 | $major = (int) $matches['major']; |
28 | 28 |
|
29 | | -if (10 <= $major) { |
30 | | - /** |
31 | | - * @internal |
32 | | - */ |
33 | | - final class Extension implements Runner\Extension\Extension |
34 | | - { |
35 | | - public function bootstrap( |
36 | | - TextUI\Configuration\Configuration $configuration, |
37 | | - Runner\Extension\Facade $facade, |
38 | | - Runner\Extension\ParameterCollection $parameters |
39 | | - ): void { |
40 | | - if ($configuration->noOutput()) { |
41 | | - return; |
42 | | - } |
43 | | - |
44 | | - $maximumCount = Count::fromInt(10); |
45 | | - |
46 | | - if ($parameters->has('maximum-count')) { |
47 | | - $maximumCount = Count::fromInt((int) $parameters->get('maximum-count')); |
48 | | - } |
49 | | - |
50 | | - $maximumDuration = Duration::fromMilliseconds(500); |
51 | | - |
52 | | - if ($parameters->has('maximum-duration')) { |
53 | | - $maximumDuration = Duration::fromMilliseconds((int) $parameters->get('maximum-duration')); |
54 | | - } |
55 | | - |
56 | | - $timeKeeper = new TimeKeeper(); |
57 | | - $collector = new Collector\DefaultCollector(); |
58 | | - $reporter = new Reporter\DefaultReporter( |
59 | | - new Formatter\DefaultDurationFormatter(), |
60 | | - $maximumDuration, |
61 | | - $maximumCount, |
62 | | - ); |
63 | | - |
64 | | - $facade->registerSubscribers( |
65 | | - new Subscriber\TestPreparedSubscriber($timeKeeper), |
66 | | - new Subscriber\TestPassedSubscriber( |
67 | | - $maximumDuration, |
68 | | - $timeKeeper, |
69 | | - $collector, |
70 | | - ), |
71 | | - new Subscriber\TestRunnerExecutionFinishedSubscriber( |
72 | | - $collector, |
73 | | - $reporter, |
74 | | - ), |
75 | | - ); |
76 | | - } |
77 | | - } |
78 | | -} elseif (9 === $major) { |
| 29 | +if (9 === $major) { |
79 | 30 | /** |
80 | 31 | * @internal |
81 | 32 | */ |
@@ -215,6 +166,55 @@ private function resolveMaximumDuration(string $test): Duration |
215 | 166 | return $this->maximumDuration; |
216 | 167 | } |
217 | 168 | } |
| 169 | +} elseif (10 <= $major) { |
| 170 | + /** |
| 171 | + * @internal |
| 172 | + */ |
| 173 | + final class Extension implements Runner\Extension\Extension |
| 174 | + { |
| 175 | + public function bootstrap( |
| 176 | + TextUI\Configuration\Configuration $configuration, |
| 177 | + Runner\Extension\Facade $facade, |
| 178 | + Runner\Extension\ParameterCollection $parameters |
| 179 | + ): void { |
| 180 | + if ($configuration->noOutput()) { |
| 181 | + return; |
| 182 | + } |
| 183 | + |
| 184 | + $maximumCount = Count::fromInt(10); |
| 185 | + |
| 186 | + if ($parameters->has('maximum-count')) { |
| 187 | + $maximumCount = Count::fromInt((int) $parameters->get('maximum-count')); |
| 188 | + } |
| 189 | + |
| 190 | + $maximumDuration = Duration::fromMilliseconds(500); |
| 191 | + |
| 192 | + if ($parameters->has('maximum-duration')) { |
| 193 | + $maximumDuration = Duration::fromMilliseconds((int) $parameters->get('maximum-duration')); |
| 194 | + } |
| 195 | + |
| 196 | + $timeKeeper = new TimeKeeper(); |
| 197 | + $collector = new Collector\DefaultCollector(); |
| 198 | + $reporter = new Reporter\DefaultReporter( |
| 199 | + new Formatter\DefaultDurationFormatter(), |
| 200 | + $maximumDuration, |
| 201 | + $maximumCount, |
| 202 | + ); |
| 203 | + |
| 204 | + $facade->registerSubscribers( |
| 205 | + new Subscriber\TestPreparedSubscriber($timeKeeper), |
| 206 | + new Subscriber\TestPassedSubscriber( |
| 207 | + $maximumDuration, |
| 208 | + $timeKeeper, |
| 209 | + $collector, |
| 210 | + ), |
| 211 | + new Subscriber\TestRunnerExecutionFinishedSubscriber( |
| 212 | + $collector, |
| 213 | + $reporter, |
| 214 | + ), |
| 215 | + ); |
| 216 | + } |
| 217 | + } |
218 | 218 | } else { |
219 | 219 | throw new \RuntimeException(\sprintf( |
220 | 220 | 'Unable to select extension for PHPUnit version with version identifier "%s".', |
|
0 commit comments