From d2eb94d7235dfa691f750dc807edd6a2bb3569d6 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 12 Dec 2024 11:50:43 +0000 Subject: [PATCH] chore: bumps phpunit and paratest --- bin/worker.php | 11 +++++-- composer.json | 6 ++-- src/Bootstrappers/BootOverrides.php | 2 +- .../Parallel/Paratest/WrapperRunner.php | 30 ++++++++++++++----- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/bin/worker.php b/bin/worker.php index 9ee168d4..c26b05eb 100644 --- a/bin/worker.php +++ b/bin/worker.php @@ -32,10 +32,13 @@ $bootPest = (static function (): void { 'status-file:', 'progress-file:', 'unexpected-output-file:', - 'testresult-file:', + 'test-result-file:', + 'result-cache-file:', 'teamcity-file:', 'testdox-file:', 'testdox-color', + 'testdox-columns:', + 'testdox-summary', 'phpunit-argv:', ]); @@ -61,7 +64,8 @@ $bootPest = (static function (): void { assert(isset($getopt['progress-file']) && is_string($getopt['progress-file'])); assert(isset($getopt['unexpected-output-file']) && is_string($getopt['unexpected-output-file'])); - assert(isset($getopt['testresult-file']) && is_string($getopt['testresult-file'])); + assert(isset($getopt['test-result-file']) && is_string($getopt['test-result-file'])); + assert(! isset($getopt['result-cache-file']) || is_string($getopt['result-cache-file'])); assert(! isset($getopt['teamcity-file']) || is_string($getopt['teamcity-file'])); assert(! isset($getopt['testdox-file']) || is_string($getopt['testdox-file'])); @@ -77,7 +81,8 @@ $bootPest = (static function (): void { $phpunitArgv, $getopt['progress-file'], $getopt['unexpected-output-file'], - $getopt['testresult-file'], + $getopt['test-result-file'], + $getopt['result-cache-file'] ?? null, $getopt['teamcity-file'] ?? null, $getopt['testdox-file'] ?? null, isset($getopt['testdox-color']), diff --git a/composer.json b/composer.json index b56c6d92..50423f3b 100644 --- a/composer.json +++ b/composer.json @@ -18,17 +18,17 @@ ], "require": { "php": "^8.2.0", - "brianium/paratest": "^7.6.2", + "brianium/paratest": "^7.7.0", "nunomaduro/collision": "^8.5.0", "nunomaduro/termwind": "^2.3.0", "pestphp/pest-plugin": "^3.0.0", "pestphp/pest-plugin-arch": "^3.0.0", "pestphp/pest-plugin-mutate": "^3.0.5", - "phpunit/phpunit": "^11.5.0" + "phpunit/phpunit": "^11.5.1" }, "conflict": { "filp/whoops": "<2.16.0", - "phpunit/phpunit": ">11.5.0", + "phpunit/phpunit": ">11.5.1", "sebastian/exporter": "<6.0.0", "webmozart/assert": "<1.11.0" }, diff --git a/src/Bootstrappers/BootOverrides.php b/src/Bootstrappers/BootOverrides.php index 9dc5aa53..8e58c61c 100644 --- a/src/Bootstrappers/BootOverrides.php +++ b/src/Bootstrappers/BootOverrides.php @@ -19,7 +19,7 @@ final class BootOverrides implements Bootstrapper */ public const FILES = [ '53c246e5f416a39817ac81124cdd64ea8403038d01d7a202e1ffa486fbdf3fa7' => 'Runner/Filter/NameFilterIterator.php', - 'a4a43de01f641c6944ee83d963795a46d32b5206b5ab3bbc6cce76e67190acbf' => 'Runner/ResultCache/DefaultResultCache.php', + '77ffb7647b583bd82e37962c6fbdc4b04d3344d8a2c1ed103e625ed1ff7cb5c2' => 'Runner/ResultCache/DefaultResultCache.php', 'd0e81317889ad88c707db4b08a94cadee4c9010d05ff0a759f04e71af5efed89' => 'Runner/TestSuiteLoader.php', '3bb609b0d3bf6dee8df8d6cd62a3c8ece823c4bb941eaaae39e3cb267171b9d2' => 'TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php', '8abdad6413329c6fe0d7d44a8b9926e390af32c0b3123f3720bb9c5bbc6fbb7e' => 'TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php', diff --git a/src/Plugins/Parallel/Paratest/WrapperRunner.php b/src/Plugins/Parallel/Paratest/WrapperRunner.php index b66c7d33..282749d3 100644 --- a/src/Plugins/Parallel/Paratest/WrapperRunner.php +++ b/src/Plugins/Parallel/Paratest/WrapperRunner.php @@ -19,6 +19,7 @@ use Pest\TestSuite; use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Event\TestRunner\WarningTriggered; use PHPUnit\Runner\CodeCoverage; +use PHPUnit\Runner\ResultCache\DefaultResultCache; use PHPUnit\TestRunner\TestResult\Facade as TestResultFacade; use PHPUnit\TestRunner\TestResult\TestResult; use PHPUnit\TextUI\Configuration\CodeCoverageFilterRegistry; @@ -79,7 +80,10 @@ final class WrapperRunner implements RunnerInterface private array $unexpectedOutputFiles = []; /** @var list */ - private array $testresultFiles = []; + private array $resultCacheFiles = []; + + /** @var list */ + private array $testResultFiles = []; /** @var list */ private array $coverageFiles = []; @@ -264,7 +268,8 @@ final class WrapperRunner implements RunnerInterface $this->batches[$token] = 0; $this->unexpectedOutputFiles[] = $worker->unexpectedOutputFile; - $this->testresultFiles[] = $worker->testresultFile; + $this->unexpectedOutputFiles[] = $worker->unexpectedOutputFile; + $this->testResultFiles[] = $worker->testResultFile; if (isset($worker->junitFile)) { $this->junitFiles[] = $worker->junitFile; @@ -298,12 +303,12 @@ final class WrapperRunner implements RunnerInterface private function complete(TestResult $testResultSum): int { - foreach ($this->testresultFiles as $testresultFile) { - if (! $testresultFile->isFile()) { + foreach ($this->testResultFiles as $testResultFile) { + if (! $testResultFile->isFile()) { continue; } - $contents = file_get_contents($testresultFile->getPathname()); + $contents = file_get_contents($testResultFile->getPathname()); assert($contents !== false); $testResult = unserialize($contents); assert($testResult instanceof TestResult); @@ -360,9 +365,20 @@ final class WrapperRunner implements RunnerInterface $testResultSum->phpNotices(), $testResultSum->phpWarnings(), $testResultSum->numberOfIssuesIgnoredByBaseline(), - ); + if ($this->options->configuration->cacheResult()) { + $resultCacheSum = new DefaultResultCache($this->options->configuration->testResultCacheFile()); + foreach ($this->resultCacheFiles as $resultCacheFile) { + $resultCache = new DefaultResultCache($resultCacheFile->getPathname()); + $resultCache->load(); + + $resultCacheSum->mergeWith($resultCache); + } + + $resultCacheSum->persist(); + } + $this->printer->printResults( $testResultSum, $this->teamcityFiles, @@ -375,7 +391,7 @@ final class WrapperRunner implements RunnerInterface $exitcode = Result::exitCode($this->options->configuration, $testResultSum); $this->clearFiles($this->unexpectedOutputFiles); - $this->clearFiles($this->testresultFiles); + $this->clearFiles($this->testResultFiles); $this->clearFiles($this->coverageFiles); $this->clearFiles($this->junitFiles); $this->clearFiles($this->teamcityFiles);