diff --git a/src/WrapperRunner/ApplicationForWrapperWorker.php b/src/WrapperRunner/ApplicationForWrapperWorker.php index 54a91ec0..cacf210b 100644 --- a/src/WrapperRunner/ApplicationForWrapperWorker.php +++ b/src/WrapperRunner/ApplicationForWrapperWorker.php @@ -15,6 +15,7 @@ use PHPUnit\Runner\Baseline\CannotLoadBaselineException; use PHPUnit\Runner\Baseline\Reader; use PHPUnit\Runner\CodeCoverage; +use PHPUnit\Runner\DeprecationCollector\Facade as DeprecationCollector; use PHPUnit\Runner\ErrorHandler; use PHPUnit\Runner\Extension\ExtensionBootstrapper; use PHPUnit\Runner\Extension\Facade as ExtensionFacade; @@ -170,12 +171,6 @@ private function bootstrap(): void $extensionRequiresCodeCoverageCollection = $extensionFacade->requiresCodeCoverageCollection(); } - CodeCoverage::instance()->init( - $this->configuration, - CodeCoverageFilterRegistry::instance(), - $extensionRequiresCodeCoverageCollection, - ); - if ($this->configuration->hasLogfileJunit()) { new JunitXmlLogger( DefaultPrinter::from($this->configuration->logfileJunit()), @@ -212,6 +207,7 @@ private function bootstrap(): void } TestResultFacade::init(); + DeprecationCollector::init(); if ($this->configuration->source()->useBaseline()) { $baselineFile = $this->configuration->source()->baseline(); @@ -229,6 +225,13 @@ private function bootstrap(): void } EventFacade::instance()->seal(); + + CodeCoverage::instance()->init( + $this->configuration, + CodeCoverageFilterRegistry::instance(), + $extensionRequiresCodeCoverageCollection, + ); + EventFacade::emitter()->testRunnerStarted(); if ($this->configuration->executionOrder() === TestSuiteSorter::ORDER_RANDOMIZED) { diff --git a/test/Unit/WrapperRunner/WrapperRunnerTest.php b/test/Unit/WrapperRunner/WrapperRunnerTest.php index b7dca8df..d3fdb048 100644 --- a/test/Unit/WrapperRunner/WrapperRunnerTest.php +++ b/test/Unit/WrapperRunner/WrapperRunnerTest.php @@ -756,6 +756,28 @@ public function testBaselineIsRespected(): void Time: %s, Memory: %s MB +OK%a +EOF; + self::assertStringMatchesFormat($expectedOutput, $runnerResult->output); + self::assertEquals(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode); + } + + #[Group('github')] + public function testDeprecationsShouldNotRaiseException(): void + { + $this->bareOptions['--configuration'] = $this->fixture('github' . DIRECTORY_SEPARATOR . 'GH915' . DIRECTORY_SEPARATOR . 'phpunit.xml'); + + $runnerResult = $this->runRunner(); + + $expectedOutput = <<<'EOF' +Processes: %s +Runtime: PHP %s +Configuration: %s + +. 1 / 1 (100%) + +Time: %s, Memory: %s MB + OK%a EOF; self::assertStringMatchesFormat($expectedOutput, $runnerResult->output); diff --git a/test/fixtures/github/GH915/IssueTest.php b/test/fixtures/github/GH915/IssueTest.php new file mode 100644 index 00000000..820a8d7f --- /dev/null +++ b/test/fixtures/github/GH915/IssueTest.php @@ -0,0 +1,16 @@ + + + + + IssueTest.php + + +