mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 02:07:23 +01:00
refactor: parallel
This commit is contained in:
@ -21,8 +21,7 @@ final class CleanConsoleOutput extends ConsoleOutput
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given message is the descriptive message
|
||||
* that Paratest outputs when it starts.
|
||||
* Removes the opening headline, witch is not needed.
|
||||
*/
|
||||
private function isOpeningHeadline(string $message): bool
|
||||
{
|
||||
|
||||
@ -28,12 +28,16 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/** @internal */
|
||||
final class ResultPrinter
|
||||
{
|
||||
/**
|
||||
* The "native" printer.
|
||||
*/
|
||||
public readonly Printer $printer;
|
||||
|
||||
/**
|
||||
* The "compact" printer.
|
||||
*/
|
||||
private readonly CompactPrinter $compactPrinter;
|
||||
|
||||
private int $totalCases = 0;
|
||||
|
||||
/** @var resource|null */
|
||||
private $teamcityLogFileHandle;
|
||||
|
||||
@ -61,7 +65,7 @@ final class ResultPrinter
|
||||
}
|
||||
};
|
||||
|
||||
$this->compactPrinter = new CompactPrinter();
|
||||
$this->compactPrinter = CompactPrinter::default();
|
||||
|
||||
if (! $this->options->configuration->hasLogfileTeamcity()) {
|
||||
return;
|
||||
@ -72,17 +76,12 @@ final class ResultPrinter
|
||||
$this->teamcityLogFileHandle = $teamcityLogFileHandle;
|
||||
}
|
||||
|
||||
public function setTestCount(int $testCount): void
|
||||
{
|
||||
$this->totalCases = $testCount;
|
||||
}
|
||||
|
||||
public function start(): void
|
||||
public function start(int $numberOfTests): void
|
||||
{
|
||||
$this->compactPrinter->line(sprintf(
|
||||
'Running %d test%s using %d process%s',
|
||||
$this->totalCases,
|
||||
$this->totalCases === 1 ? '' : 's',
|
||||
$numberOfTests,
|
||||
$numberOfTests === 1 ? '' : 's',
|
||||
$this->options->processes,
|
||||
$this->options->processes === 1 ? '' : 'es')
|
||||
);
|
||||
|
||||
@ -121,8 +121,7 @@ final class WrapperRunner implements RunnerInterface
|
||||
|
||||
$result = TestResultFacade::result();
|
||||
|
||||
$this->printer->setTestCount($suiteLoader->testCount);
|
||||
$this->printer->start();
|
||||
$this->printer->start($suiteLoader->testCount);
|
||||
|
||||
$this->timer->start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user