|
38 | 38 | use PHPUnit\Runner\Filter\Factory; |
39 | 39 | use PHPUnit\Runner\PhptTestCase; |
40 | 40 | use PHPUnit\Runner\TestSuiteLoader; |
41 | | -use PHPUnit\TestRunner\TestResult\Facade; |
| 41 | +use PHPUnit\TestRunner\TestResult\Facade as TestResultFacade; |
42 | 42 | use PHPUnit\TextUI\Configuration\Registry; |
43 | 43 | use PHPUnit\Util\Filter; |
44 | 44 | use PHPUnit\Util\Reflection; |
@@ -69,13 +69,15 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test |
69 | 69 | private array $tests = []; |
70 | 70 | private ?array $providedTests = null; |
71 | 71 | private ?Factory $iteratorFilter = null; |
| 72 | + private readonly bool $stopOnDefect; |
| 73 | + private readonly bool $stopOnDeprecation; |
72 | 74 | private readonly bool $stopOnError; |
73 | 75 | private readonly bool $stopOnFailure; |
74 | | - private readonly bool $stopOnWarning; |
75 | | - private readonly bool $stopOnRisky; |
76 | 76 | private readonly bool $stopOnIncomplete; |
| 77 | + private readonly bool $stopOnNotice; |
| 78 | + private readonly bool $stopOnRisky; |
77 | 79 | private readonly bool $stopOnSkipped; |
78 | | - private readonly bool $stopOnDefect; |
| 80 | + private readonly bool $stopOnWarning; |
79 | 81 |
|
80 | 82 | public static function empty(string $name = null): static |
81 | 83 | { |
@@ -149,13 +151,15 @@ final private function __construct(string $name) |
149 | 151 |
|
150 | 152 | $configuration = Registry::get(); |
151 | 153 |
|
152 | | - $this->stopOnError = $configuration->stopOnError(); |
153 | | - $this->stopOnFailure = $configuration->stopOnFailure(); |
154 | | - $this->stopOnWarning = $configuration->stopOnWarning(); |
155 | | - $this->stopOnRisky = $configuration->stopOnRisky(); |
156 | | - $this->stopOnIncomplete = $configuration->stopOnIncomplete(); |
157 | | - $this->stopOnSkipped = $configuration->stopOnSkipped(); |
158 | | - $this->stopOnDefect = $configuration->stopOnDefect(); |
| 154 | + $this->stopOnDeprecation = $configuration->stopOnDeprecation(); |
| 155 | + $this->stopOnDefect = $configuration->stopOnDefect(); |
| 156 | + $this->stopOnError = $configuration->stopOnError(); |
| 157 | + $this->stopOnFailure = $configuration->stopOnFailure(); |
| 158 | + $this->stopOnIncomplete = $configuration->stopOnIncomplete(); |
| 159 | + $this->stopOnNotice = $configuration->stopOnNotice(); |
| 160 | + $this->stopOnRisky = $configuration->stopOnRisky(); |
| 161 | + $this->stopOnSkipped = $configuration->stopOnSkipped(); |
| 162 | + $this->stopOnWarning = $configuration->stopOnWarning(); |
159 | 163 | } |
160 | 164 |
|
161 | 165 | /** |
@@ -344,7 +348,7 @@ public function run(): void |
344 | 348 | } |
345 | 349 |
|
346 | 350 | foreach ($this as $test) { |
347 | | - if ($this->shouldStop()) { |
| 351 | + if (TestResultFacade::shouldStop()) { |
348 | 352 | break; |
349 | 353 | } |
350 | 354 |
|
@@ -550,35 +554,6 @@ private function methodDoesNotExistOrIsDeclaredInTestCase(string $methodName): b |
550 | 554 | $reflector->getMethod($methodName)->getDeclaringClass()->getName() === TestCase::class; |
551 | 555 | } |
552 | 556 |
|
553 | | - private function shouldStop(): bool |
554 | | - { |
555 | | - if (($this->stopOnDefect || $this->stopOnError) && Facade::hasTestErroredEvents()) { |
556 | | - return true; |
557 | | - } |
558 | | - |
559 | | - if (($this->stopOnDefect || $this->stopOnFailure) && Facade::hasTestFailedEvents()) { |
560 | | - return true; |
561 | | - } |
562 | | - |
563 | | - if (($this->stopOnDefect || $this->stopOnWarning) && Facade::hasWarningEvents()) { |
564 | | - return true; |
565 | | - } |
566 | | - |
567 | | - if (($this->stopOnDefect || $this->stopOnRisky) && Facade::hasTestConsideredRiskyEvents()) { |
568 | | - return true; |
569 | | - } |
570 | | - |
571 | | - if ($this->stopOnSkipped && Facade::hasTestSkippedEvents()) { |
572 | | - return true; |
573 | | - } |
574 | | - |
575 | | - if ($this->stopOnIncomplete && Facade::hasTestMarkedIncompleteEvents()) { |
576 | | - return true; |
577 | | - } |
578 | | - |
579 | | - return false; |
580 | | - } |
581 | | - |
582 | 557 | /** |
583 | 558 | * @throws Exception |
584 | 559 | */ |
|
0 commit comments