mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: --cache-directory being used on phpunit file
This commit is contained in:
@ -6,6 +6,10 @@ namespace Pest\Plugins;
|
|||||||
|
|
||||||
use Pest\Contracts\Plugins\HandlesArguments;
|
use Pest\Contracts\Plugins\HandlesArguments;
|
||||||
use Pest\Plugins\Concerns\HandleArguments;
|
use Pest\Plugins\Concerns\HandleArguments;
|
||||||
|
use PHPUnit\TextUI\CliArguments\Builder as CliConfigurationBuilder;
|
||||||
|
use PHPUnit\TextUI\CliArguments\XmlConfigurationFileFinder;
|
||||||
|
use PHPUnit\TextUI\XmlConfiguration\DefaultConfiguration;
|
||||||
|
use PHPUnit\TextUI\XmlConfiguration\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -31,10 +35,20 @@ final class Cache implements HandlesArguments
|
|||||||
public function handleArguments(array $arguments): array
|
public function handleArguments(array $arguments): array
|
||||||
{
|
{
|
||||||
if (! $this->hasArgument('--cache-directory', $arguments)) {
|
if (! $this->hasArgument('--cache-directory', $arguments)) {
|
||||||
$arguments = $this->pushArgument('--cache-directory', $arguments);
|
|
||||||
|
|
||||||
|
$cliConfiguration = (new CliConfigurationBuilder)->fromParameters([]);
|
||||||
|
$configurationFile = (new XmlConfigurationFileFinder)->find($cliConfiguration);
|
||||||
|
$xmlConfiguration = DefaultConfiguration::create();
|
||||||
|
|
||||||
|
if ($configurationFile) {
|
||||||
|
$xmlConfiguration = (new Loader)->load($configurationFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $xmlConfiguration->phpunit()->hasCacheDirectory()) {
|
||||||
|
$arguments = $this->pushArgument('--cache-directory', $arguments);
|
||||||
$arguments = $this->pushArgument((string) realpath(self::TEMPORARY_FOLDER), $arguments);
|
$arguments = $this->pushArgument((string) realpath(self::TEMPORARY_FOLDER), $arguments);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $this->hasArgument('--parallel', $arguments)) {
|
if (! $this->hasArgument('--parallel', $arguments)) {
|
||||||
return $this->pushArgument('--cache-result', $arguments);
|
return $this->pushArgument('--cache-result', $arguments);
|
||||||
|
|||||||
1
tests/.cache/test-results
Normal file
1
tests/.cache/test-results
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":"pest_2.32.2","defects":[],"times":{"P\\Tests\\Playground::__pest_evaluable_basic":0.005}}
|
||||||
Reference in New Issue
Block a user