mirror of
https://github.com/pestphp/pest.git
synced 2026-12-03 22:45:06 +01:00
fix: support brianium/paratest 7.28 grouped test files (#2025)
This commit is contained in:
committed by
GitHub
parent
b9185c034c
commit
cf20587575
+1
-1
@@ -18,7 +18,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.4",
|
||||
"brianium/paratest": "^7.27.5",
|
||||
"brianium/paratest": "^7.28.0",
|
||||
"nunomaduro/collision": "^8.9.5",
|
||||
"nunomaduro/termwind": "^2.4.0",
|
||||
"pestphp/pest-plugin": "^5.0.0",
|
||||
|
||||
@@ -75,7 +75,7 @@ final class WrapperRunner implements RunnerInterface
|
||||
|
||||
private readonly Timer $timer;
|
||||
|
||||
/** @var list<non-empty-string> */
|
||||
/** @var list<non-empty-list<non-empty-string>> */
|
||||
private array $pending = [];
|
||||
|
||||
private int $exitcode = -1;
|
||||
@@ -248,7 +248,7 @@ final class WrapperRunner implements RunnerInterface
|
||||
|
||||
$this->flushWorker($worker);
|
||||
|
||||
if ($batchSize !== 0 && $this->batches[$token] === $batchSize) {
|
||||
if ($batchSize !== 0 && $this->batches[$token] >= $batchSize) {
|
||||
$this->destroyWorker($token);
|
||||
$worker = $this->startWorker($token);
|
||||
}
|
||||
@@ -260,7 +260,7 @@ final class WrapperRunner implements RunnerInterface
|
||||
$this->pending = [];
|
||||
} elseif (($pending = array_shift($this->pending)) !== null) {
|
||||
$worker->assign($pending);
|
||||
$this->batches[$token]++;
|
||||
$this->batches[$token] += count($pending);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,19 +635,34 @@ final class WrapperRunner implements RunnerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, non-empty-string>
|
||||
* @return list<non-empty-list<non-empty-string>>
|
||||
*/
|
||||
private function getTestFiles(SuiteLoader $suiteLoader): array
|
||||
{
|
||||
/** @var array<non-empty-string, null> $files */
|
||||
/** @var array<non-empty-string, true> $files */
|
||||
$files = [];
|
||||
|
||||
foreach (array_filter(
|
||||
$suiteLoader->tests,
|
||||
fn (string $filename): bool => ! str_ends_with($filename, "eval()'d code")
|
||||
) as $filename) {
|
||||
$resolved = realpath($filename) ?: $filename;
|
||||
$files[$resolved] = null;
|
||||
/** @var list<non-empty-list<non-empty-string>> $groups */
|
||||
$groups = [];
|
||||
|
||||
foreach ($suiteLoader->tests as $tests) {
|
||||
$group = [];
|
||||
|
||||
foreach (array_filter(
|
||||
$tests,
|
||||
fn (string $filename): bool => ! str_ends_with($filename, "eval()'d code")
|
||||
) as $filename) {
|
||||
$resolved = realpath($filename) ?: $filename;
|
||||
|
||||
if (! isset($files[$resolved])) {
|
||||
$files[$resolved] = true;
|
||||
$group[] = $resolved;
|
||||
}
|
||||
}
|
||||
|
||||
if ($group !== []) {
|
||||
$groups[] = $group;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (TestSuite::getInstance()->tests->getFilenames() as $filename) {
|
||||
@@ -655,11 +670,15 @@ final class WrapperRunner implements RunnerInterface
|
||||
$resolved = realpath($filename)
|
||||
?: realpath($this->options->cwd.DIRECTORY_SEPARATOR.$filename)
|
||||
?: $filename;
|
||||
$files[$resolved] = null;
|
||||
|
||||
if (! isset($files[$resolved])) {
|
||||
$files[$resolved] = true;
|
||||
$groups[] = [$resolved];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_keys($files);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
private function shouldIncludeBootstrappedTestFile(string $filename): bool
|
||||
|
||||
Reference in New Issue
Block a user