mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat(parallel): Adds support for plugins to filter parallel arguments
This commit is contained in:
@ -2,7 +2,7 @@ ARG PHP=8.1
|
||||
FROM php:${PHP}-cli-alpine
|
||||
|
||||
RUN apk update \
|
||||
&& apk add zip libzip-dev icu-dev
|
||||
&& apk add zip libzip-dev icu-dev git
|
||||
|
||||
RUN docker-php-ext-configure zip
|
||||
RUN docker-php-ext-install zip
|
||||
|
||||
@ -10,7 +10,7 @@ namespace Pest\Contracts\Plugins;
|
||||
interface HandlesArguments
|
||||
{
|
||||
/**
|
||||
* Adds arguments before of the Test Suite execution.
|
||||
* Adds arguments before the Test Suite execution.
|
||||
*
|
||||
* @param array<int, string> $arguments
|
||||
* @return array<int, string>
|
||||
|
||||
@ -15,9 +15,7 @@ use Pest\Support\Container;
|
||||
use Pest\TestSuite;
|
||||
use function Pest\version;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
final class Parallel implements HandlesArguments
|
||||
{
|
||||
@ -86,12 +84,6 @@ final class Parallel implements HandlesArguments
|
||||
*/
|
||||
private function runTestSuiteInParallel(array $arguments): int
|
||||
{
|
||||
if (! class_exists(ParaTestCommand::class)) {
|
||||
$this->askUserToInstallParatest();
|
||||
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
$handlers = array_filter(
|
||||
array_map(fn ($handler): object|string => Container::getInstance()->get($handler), self::HANDLERS),
|
||||
fn ($handler): bool => $handler instanceof HandlesArguments,
|
||||
@ -128,20 +120,6 @@ final class Parallel implements HandlesArguments
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a message to the user asking them to install ParaTest as a dev dependency.
|
||||
*/
|
||||
private function askUserToInstallParatest(): void
|
||||
{
|
||||
/** @var OutputInterface $output */
|
||||
$output = Container::getInstance()->get(OutputInterface::class);
|
||||
|
||||
$output->writeln([
|
||||
'<fg=red>Pest Parallel requires ParaTest to run.</>',
|
||||
'Please run <fg=yellow>composer require --dev brianium/paratest</>.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an instance of the Paratest command.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user