mirror of
https://github.com/pestphp/pest.git
synced 2026-12-05 15:22:17 +01:00
chore: coding style changes
This commit is contained in:
@@ -14,8 +14,6 @@ use Pest\ArchPresets\Relaxed;
|
||||
use Pest\ArchPresets\Security;
|
||||
use Pest\ArchPresets\Strict;
|
||||
use Pest\Exceptions\InvalidArgumentException;
|
||||
use Pest\PendingCalls\TestCall;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -23,70 +21,46 @@ use stdClass;
|
||||
final class Preset
|
||||
{
|
||||
/**
|
||||
* The application / package base namespaces.
|
||||
*
|
||||
* @var ?array<int, string>
|
||||
*/
|
||||
private static ?array $baseNamespaces = null;
|
||||
|
||||
/**
|
||||
* The custom presets.
|
||||
*
|
||||
* @var array<string, Closure>
|
||||
*/
|
||||
private static array $customPresets = [];
|
||||
|
||||
/**
|
||||
* Creates a new preset instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Pest php preset and returns the test call instance.
|
||||
*/
|
||||
public function php(): Php
|
||||
{
|
||||
return $this->executePreset(new Php($this->baseNamespaces()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Pest laravel preset and returns the test call instance.
|
||||
*/
|
||||
public function laravel(): Laravel
|
||||
{
|
||||
return $this->executePreset(new Laravel($this->baseNamespaces()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Pest strict preset and returns the test call instance.
|
||||
*/
|
||||
public function strict(): Strict
|
||||
{
|
||||
return $this->executePreset(new Strict($this->baseNamespaces()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Pest security preset and returns the test call instance.
|
||||
*/
|
||||
public function security(): AbstractPreset
|
||||
{
|
||||
return $this->executePreset(new Security($this->baseNamespaces()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Pest relaxed preset and returns the test call instance.
|
||||
*/
|
||||
public function relaxed(): AbstractPreset
|
||||
{
|
||||
return $this->executePreset(new Relaxed($this->baseNamespaces()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Pest custom preset and returns the test call instance.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function custom(string $name, Closure $execute): void
|
||||
@@ -99,8 +73,6 @@ final class Preset
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls to the class.
|
||||
*
|
||||
* @param array<int, mixed> $arguments
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
@@ -120,8 +92,6 @@ final class Preset
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given preset.
|
||||
*
|
||||
* @template TPreset of AbstractPreset
|
||||
*
|
||||
* @param TPreset $preset
|
||||
@@ -133,16 +103,10 @@ final class Preset
|
||||
|
||||
$preset->execute();
|
||||
|
||||
// $this->testCall->testCaseMethod->closure = (function () use ($preset): void {
|
||||
// $preset->flush();
|
||||
// })->bindTo(new stdClass);
|
||||
|
||||
return $preset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base namespaces for the application / package.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
private function baseNamespaces(): array
|
||||
|
||||
Reference in New Issue
Block a user