mirror of
https://github.com/pestphp/pest.git
synced 2026-04-20 22:20:17 +02:00
35 lines
657 B
PHP
35 lines
657 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pest\Plugins;
|
|
|
|
use Pest\Contracts\Plugins\HandlesArguments;
|
|
use Pest\TestSuite;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class Snapshot implements HandlesArguments
|
|
{
|
|
use Concerns\HandleArguments;
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function handleArguments(array $arguments): array
|
|
{
|
|
if (Parallel::isWorker()) {
|
|
return $arguments;
|
|
}
|
|
|
|
if (! $this->hasArgument('--update-snapshots', $arguments)) {
|
|
return $arguments;
|
|
}
|
|
|
|
TestSuite::getInstance()->snapshots->flush();
|
|
|
|
return $this->popArgument('--update-snapshots', $arguments);
|
|
}
|
|
}
|