mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 01:07:23 +01:00
fix: missing things on junit
This commit is contained in:
44
src/Plugins/JUnit.php
Normal file
44
src/Plugins/JUnit.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Plugins;
|
||||
|
||||
use Pest\Contracts\Plugins\HandlesArguments;
|
||||
use Pest\Plugins\Concerns\HandleArguments;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class JUnit implements HandlesArguments
|
||||
{
|
||||
use HandleArguments;
|
||||
|
||||
/**
|
||||
* Handles the arguments, adding the cache directory and the cache result arguments.
|
||||
*/
|
||||
public function handleArguments(array $arguments): array
|
||||
{
|
||||
if (! $this->hasArgument('--log-junit', $arguments)) {
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
$logUnitArgument = null;
|
||||
|
||||
$arguments = array_filter($arguments, function (string $argument) use (&$logUnitArgument): bool {
|
||||
if (str_starts_with($argument, '--log-junit')) {
|
||||
$logUnitArgument = $argument;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
assert(is_string($logUnitArgument));
|
||||
|
||||
$arguments[] = $logUnitArgument;
|
||||
|
||||
return array_values($arguments);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user