mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
style: plugin actions improvements
This commit is contained in:
@ -69,7 +69,7 @@ $bootPest = (static function (): void {
|
|||||||
|
|
||||||
$bootPest();
|
$bootPest();
|
||||||
|
|
||||||
$phpunitArgv = (new CallsHandleArguments())($phpunitArgv);
|
$phpunitArgv = CallsHandleArguments::execute($phpunitArgv);
|
||||||
|
|
||||||
$application = new ApplicationForWrapperWorker(
|
$application = new ApplicationForWrapperWorker(
|
||||||
$phpunitArgv,
|
$phpunitArgv,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use Pest\Contracts\Bootstrapper;
|
|||||||
use Pest\Exceptions\NoDirtyTestsFound;
|
use Pest\Exceptions\NoDirtyTestsFound;
|
||||||
use Pest\Plugins\Actions\CallsAddsOutput;
|
use Pest\Plugins\Actions\CallsAddsOutput;
|
||||||
use Pest\Plugins\Actions\CallsBoot;
|
use Pest\Plugins\Actions\CallsBoot;
|
||||||
|
use Pest\Plugins\Actions\CallsHandleArguments;
|
||||||
use Pest\Plugins\Actions\CallsShutdown;
|
use Pest\Plugins\Actions\CallsShutdown;
|
||||||
use Pest\Support\Container;
|
use Pest\Support\Container;
|
||||||
use PHPUnit\TextUI\Application;
|
use PHPUnit\TextUI\Application;
|
||||||
@ -68,7 +69,7 @@ final class Kernel
|
|||||||
$bootstrapper->boot();
|
$bootstrapper->boot();
|
||||||
}
|
}
|
||||||
|
|
||||||
(new CallsBoot())->__invoke();
|
CallsBoot::execute();
|
||||||
|
|
||||||
return new self(
|
return new self(
|
||||||
new Application(),
|
new Application(),
|
||||||
@ -83,7 +84,7 @@ final class Kernel
|
|||||||
*/
|
*/
|
||||||
public function handle(array $args): int
|
public function handle(array $args): int
|
||||||
{
|
{
|
||||||
$args = (new Plugins\Actions\CallsHandleArguments())->__invoke($args);
|
$args = CallsHandleArguments::execute($args);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->application->run($args);
|
$this->application->run($args);
|
||||||
@ -95,7 +96,7 @@ final class Kernel
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (new CallsAddsOutput())->__invoke(
|
return CallsAddsOutput::execute(
|
||||||
Result::exitCode(),
|
Result::exitCode(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -105,6 +106,6 @@ final class Kernel
|
|||||||
*/
|
*/
|
||||||
public function shutdown(): void
|
public function shutdown(): void
|
||||||
{
|
{
|
||||||
(new CallsShutdown())->__invoke();
|
CallsShutdown::execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ final class CallsAddsOutput
|
|||||||
*
|
*
|
||||||
* Provides an opportunity for any plugins that want to provide additional output after test execution.
|
* Provides an opportunity for any plugins that want to provide additional output after test execution.
|
||||||
*/
|
*/
|
||||||
public function __invoke(int $exitCode): int
|
public static function execute(int $exitCode): int
|
||||||
{
|
{
|
||||||
$plugins = Loader::getPlugins(Plugins\AddsOutput::class);
|
$plugins = Loader::getPlugins(Plugins\AddsOutput::class);
|
||||||
|
|
||||||
|
|||||||
@ -15,9 +15,9 @@ final class CallsBoot
|
|||||||
/**
|
/**
|
||||||
* Executes the Plugin action.
|
* Executes the Plugin action.
|
||||||
*
|
*
|
||||||
* Provides an opportunity for any plugins to boot..
|
* Provides an opportunity for any plugins to boot.
|
||||||
*/
|
*/
|
||||||
public function __invoke(): void
|
public static function execute(): void
|
||||||
{
|
{
|
||||||
$plugins = Loader::getPlugins(Plugins\Bootable::class);
|
$plugins = Loader::getPlugins(Plugins\Bootable::class);
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ final class CallsHandleArguments
|
|||||||
* @param array<int, string> $argv
|
* @param array<int, string> $argv
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
public function __invoke(array $argv): array
|
public static function execute(array $argv): array
|
||||||
{
|
{
|
||||||
$plugins = Loader::getPlugins(Plugins\HandlesArguments::class);
|
$plugins = Loader::getPlugins(Plugins\HandlesArguments::class);
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ final class CallsShutdown
|
|||||||
*
|
*
|
||||||
* Provides an opportunity for any plugins to shutdown.
|
* Provides an opportunity for any plugins to shutdown.
|
||||||
*/
|
*/
|
||||||
public function __invoke(): void
|
public static function execute(): void
|
||||||
{
|
{
|
||||||
$plugins = Loader::getPlugins(Plugins\Shutdownable::class);
|
$plugins = Loader::getPlugins(Plugins\Shutdownable::class);
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Plugins;
|
namespace Pest\Plugins;
|
||||||
|
|
||||||
use ParaTest\ParaTestCommand;
|
use ParaTest\ParaTestCommand;
|
||||||
|
use Pest\Contracts\Plugins\AddsOutput;
|
||||||
use Pest\Contracts\Plugins\HandlesArguments;
|
use Pest\Contracts\Plugins\HandlesArguments;
|
||||||
use Pest\Plugins\Actions\CallsAddsOutput;
|
use Pest\Plugins\Actions\CallsAddsOutput;
|
||||||
use Pest\Plugins\Concerns\HandleArguments;
|
use Pest\Plugins\Concerns\HandleArguments;
|
||||||
@ -105,7 +106,7 @@ final class Parallel implements HandlesArguments
|
|||||||
|
|
||||||
$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput());
|
$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput());
|
||||||
|
|
||||||
return (new CallsAddsOutput())($exitCode);
|
return CallsAddsOutput::execute($exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user