mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
chore(cleanup): Tidy-up and tweaks of Pest Parallel integration.
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -45,9 +45,6 @@ $bootPest = (static function (): void {
|
|||||||
'phpunit-argv:',
|
'phpunit-argv:',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
require_once __DIR__.'/../overrides/Runner/TestSuiteLoader.php';
|
|
||||||
require_once __DIR__.'/../overrides/Runner/Filter/NameFilterIterator.php';
|
|
||||||
|
|
||||||
$composerAutoloadFiles = [
|
$composerAutoloadFiles = [
|
||||||
dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'autoload.php',
|
dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'autoload.php',
|
||||||
dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php',
|
dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php',
|
||||||
@ -63,6 +60,15 @@ $bootPest = (static function (): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once __DIR__.'/../overrides/Runner/TestSuiteLoader.php';
|
||||||
|
require_once __DIR__.'/../overrides/Runner/Filter/NameFilterIterator.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPUnit has no understanding of "todo" tests, so the ProgressPrinter will not show
|
||||||
|
* TODO items by default. We use our own implementation here to add support for TODO.
|
||||||
|
*/
|
||||||
|
require_once __DIR__.'/../overrides/TextUI/Output/Default/ProgressPrinter/TestSkippedSubscriber.php';
|
||||||
|
|
||||||
assert(isset($getopt['status-file']) && is_string($getopt['status-file']));
|
assert(isset($getopt['status-file']) && is_string($getopt['status-file']));
|
||||||
$statusFile = fopen($getopt['status-file'], 'wb');
|
$statusFile = fopen($getopt['status-file'], 'wb');
|
||||||
assert(is_resource($statusFile));
|
assert(is_resource($statusFile));
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
/*
|
||||||
|
* This file is part of PHPUnit.
|
||||||
|
*
|
||||||
|
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
namespace PHPUnit\TextUI\Output\Default\ProgressPrinter;
|
||||||
|
|
||||||
|
use PHPUnit\Event\Test\Skipped;
|
||||||
|
use PHPUnit\Event\Test\SkippedSubscriber;
|
||||||
|
use ReflectionClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal This class is not covered by the backward compatibility promise for PHPUnit
|
||||||
|
*
|
||||||
|
* This file is only overridden when using Pest Parallel. See /bin/worker.php for more information.
|
||||||
|
*/
|
||||||
|
final class TestSkippedSubscriber extends Subscriber implements SkippedSubscriber
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Notifies the printer that a test was skipped.
|
||||||
|
*/
|
||||||
|
public function notify(Skipped $event): void
|
||||||
|
{
|
||||||
|
str_contains($event->message(), '__TODO__')
|
||||||
|
? $this->printTodoItem()
|
||||||
|
: $this->printer()->testSkipped();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints a "T" to the standard PHPUnit output to indicate a todo item.
|
||||||
|
*/
|
||||||
|
private function printTodoItem(): void
|
||||||
|
{
|
||||||
|
$mirror = new ReflectionClass($this->printer());
|
||||||
|
$printerMirror = $mirror->getMethod('printProgress');
|
||||||
|
$printerMirror->invoke($this->printer(), 'T');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,6 +22,7 @@ final class Parallel implements HandlesArguments
|
|||||||
'--parallel',
|
'--parallel',
|
||||||
'-p',
|
'-p',
|
||||||
'--no-output',
|
'--no-output',
|
||||||
|
'--cache-result',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -152,8 +152,6 @@ final class ResultPrinter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->compactPrinter->newLine();
|
|
||||||
|
|
||||||
$state = (new StateGenerator())->fromPhpUnitTestResult($testResult);
|
$state = (new StateGenerator())->fromPhpUnitTestResult($testResult);
|
||||||
|
|
||||||
$this->compactPrinter->errors($state);
|
$this->compactPrinter->errors($state);
|
||||||
|
|||||||
@ -34,6 +34,7 @@ final class CompactPrinter
|
|||||||
private const LOOKUP_TABLE = [
|
private const LOOKUP_TABLE = [
|
||||||
'.' => ['gray', '.'],
|
'.' => ['gray', '.'],
|
||||||
'S' => ['yellow', 's'],
|
'S' => ['yellow', 's'],
|
||||||
|
'T' => ['blue', 't'],
|
||||||
'I' => ['yellow', 'i'],
|
'I' => ['yellow', 'i'],
|
||||||
'N' => ['yellow', 'i'],
|
'N' => ['yellow', 'i'],
|
||||||
'R' => ['yellow', '!'],
|
'R' => ['yellow', '!'],
|
||||||
|
|||||||
Reference in New Issue
Block a user