mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pest\Actions;
|
|
|
|
use Pest\Exceptions\AttributeNotSupportedYet;
|
|
use Pest\Exceptions\FileOrFolderNotFound;
|
|
use PHPUnit\TextUI\Configuration\Configuration;
|
|
use PHPUnit\TextUI\Configuration\Registry;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class ValidatesConfiguration
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
private const CONFIGURATION_KEY = 'configuration';
|
|
|
|
/**
|
|
* Validates the configuration in the given `configuration`.
|
|
*
|
|
* @param array<string, mixed> $arguments
|
|
*/
|
|
public static function in($arguments): void
|
|
{
|
|
if (!array_key_exists(self::CONFIGURATION_KEY, $arguments) || !file_exists($arguments[self::CONFIGURATION_KEY])) {
|
|
throw new FileOrFolderNotFound('phpunit.xml');
|
|
}
|
|
|
|
$configuration = Registry::getInstance()
|
|
->get($arguments[self::CONFIGURATION_KEY])
|
|
->phpunit();
|
|
|
|
if ($configuration->processIsolation()) {
|
|
throw new AttributeNotSupportedYet('processIsolation', 'true');
|
|
}
|
|
}
|
|
}
|