mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
chore: adjusts tests
This commit is contained in:
@ -12,13 +12,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BootKernelDump implements Bootstrapper
|
||||
final readonly class BootKernelDump implements Bootstrapper
|
||||
{
|
||||
/**
|
||||
* Creates a new Boot Kernel Dump instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly OutputInterface $output,
|
||||
private OutputInterface $output,
|
||||
) {
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ final class BootOverrides implements Bootstrapper
|
||||
'8abdad6413329c6fe0d7d44a8b9926e390af32c0b3123f3720bb9c5bbc6fbb7e' => 'TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php',
|
||||
'43883b7e5811886cf3731c8ed6304d5a77078d9731e1e505abc2da36bde19f3e' => 'TextUI/TestSuiteFilterProcessor.php',
|
||||
'357d5cd7007f8559b26e1b8cdf43bb6fb15b51b79db981779da6f31b7ec39dad' => 'Event/Value/ThrowableBuilder.php',
|
||||
'676273f1fe483877cf2d95c5aedbf9ae5d6a8e2f4c12d6ce716df6591e6db023' => 'Logging/JUnit/JunitXmlLogger.php',
|
||||
'01974a686eba69b5fbb87a904d936eae2176e39567616898c5b758db71d87a22' => 'Logging/JUnit/JunitXmlLogger.php',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -13,7 +13,7 @@ use PHPUnit\Event\Subscriber;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BootSubscribers implements Bootstrapper
|
||||
final readonly class BootSubscribers implements Bootstrapper
|
||||
{
|
||||
/**
|
||||
* The list of Subscribers.
|
||||
@ -31,7 +31,7 @@ final class BootSubscribers implements Bootstrapper
|
||||
* Creates a new instance of the Boot Subscribers.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly Container $container,
|
||||
private Container $container,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
||||
@ -11,13 +11,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BootView implements Bootstrapper
|
||||
final readonly class BootView implements Bootstrapper
|
||||
{
|
||||
/**
|
||||
* Creates a new instance of the Boot View.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly OutputInterface $output
|
||||
private OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace Pest\Collision;
|
||||
|
||||
use NunoMaduro\Collision\Adapters\Phpunit\TestResult;
|
||||
use Pest\Configuration\Context;
|
||||
use Pest\Configuration\Project;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use function Termwind\render;
|
||||
@ -46,15 +46,15 @@ final class Events
|
||||
'prs' => $prs,
|
||||
] = $context;
|
||||
|
||||
if (($link = Context::getInstance()->issues) !== '') {
|
||||
if (($link = Project::getInstance()->issues) !== '') {
|
||||
$issuesDescription = array_map(fn (int $issue): string => sprintf('<a href="%s">#%s</a>', sprintf($link, $issue), $issue), $issues);
|
||||
}
|
||||
|
||||
if (($link = Context::getInstance()->prs) !== '') {
|
||||
if (($link = Project::getInstance()->prs) !== '') {
|
||||
$prsDescription = array_map(fn (int $pr): string => sprintf('<a href="%s">#%s</a>', sprintf($link, $pr), $pr), $prs);
|
||||
}
|
||||
|
||||
if (($link = Context::getInstance()->assignees) !== '' && count($assignees) > 0) {
|
||||
if (($link = Project::getInstance()->assignees) !== '' && count($assignees) > 0) {
|
||||
$assigneesDescription = array_map(fn (string $assignee): string => sprintf(
|
||||
'<a href="%s">@%s</a>',
|
||||
sprintf($link, $assignee),
|
||||
|
||||
@ -8,13 +8,15 @@ use Pest\PendingCalls\UsesCall;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @mixin UsesCall
|
||||
*/
|
||||
final class Configuration
|
||||
final readonly class Configuration
|
||||
{
|
||||
/**
|
||||
* The filename of the configuration.
|
||||
*/
|
||||
private readonly string $filename;
|
||||
private string $filename;
|
||||
|
||||
/**
|
||||
* Creates a new configuration instance.
|
||||
@ -85,10 +87,20 @@ final class Configuration
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the context configuration.
|
||||
* Gets the project configuration.
|
||||
*/
|
||||
public function context(): Configuration\Context
|
||||
public function project(): Configuration\Project
|
||||
{
|
||||
return Configuration\Context::getInstance();
|
||||
return Configuration\Project::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxies calls to the uses method.
|
||||
*
|
||||
* @param array<array-key, mixed> $arguments
|
||||
*/
|
||||
public function __call(string $name, array $arguments): mixed
|
||||
{
|
||||
return $this->uses()->$name(...$arguments); // @phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ namespace Pest\Configuration;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Context
|
||||
final class Project
|
||||
{
|
||||
/**
|
||||
* The assignees link.
|
||||
@ -36,7 +36,7 @@ final class Context
|
||||
private static ?self $instance = null;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the context.
|
||||
* Creates a new instance of the project.
|
||||
*/
|
||||
public static function getInstance(): self
|
||||
{
|
||||
@ -44,7 +44,7 @@ final class Context
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test context to GitHub.
|
||||
* Sets the test project to GitHub.
|
||||
*/
|
||||
public function github(string $project): self
|
||||
{
|
||||
@ -57,7 +57,7 @@ final class Context
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test context to GitLab.
|
||||
* Sets the test project to GitLab.
|
||||
*/
|
||||
public function gitlab(string $project): self
|
||||
{
|
||||
@ -70,7 +70,7 @@ final class Context
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test context to Bitbucket.
|
||||
* Sets the test project to Bitbucket.
|
||||
*/
|
||||
public function bitbucket(string $project): self
|
||||
{
|
||||
@ -83,7 +83,7 @@ final class Context
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test context to Jira.
|
||||
* Sets the test project to Jira.
|
||||
*/
|
||||
public function jira(string $namespace, string $project): self
|
||||
{
|
||||
@ -95,9 +95,9 @@ final class Context
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test context to custom.
|
||||
* Sets the test project to custom.
|
||||
*/
|
||||
public function using(string $issues, string $prs, string $assignees): self
|
||||
public function custom(string $issues, string $prs, string $assignees): self
|
||||
{
|
||||
$this->issues = $issues;
|
||||
$this->prs = $prs;
|
||||
@ -9,7 +9,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Help
|
||||
final readonly class Help
|
||||
{
|
||||
/**
|
||||
* The Command messages.
|
||||
@ -27,7 +27,7 @@ final class Help
|
||||
/**
|
||||
* Creates a new Console Command instance.
|
||||
*/
|
||||
public function __construct(private readonly OutputInterface $output)
|
||||
public function __construct(private OutputInterface $output)
|
||||
{
|
||||
// ..
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Thanks
|
||||
final readonly class Thanks
|
||||
{
|
||||
/**
|
||||
* The support options.
|
||||
@ -33,8 +33,8 @@ final class Thanks
|
||||
* Creates a new Console Command instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly InputInterface $input,
|
||||
private readonly OutputInterface $output
|
||||
private InputInterface $input,
|
||||
private OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ final class Expectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toHavePublicMethodsBesides(): never
|
||||
public function toHavePublicMethodsBesides(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toHavePublicMethodsBesides']);
|
||||
}
|
||||
@ -613,7 +613,7 @@ final class Expectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toHaveProtectedMethodsBesides(): never
|
||||
public function toHaveProtectedMethodsBesides(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toHaveProtectedMethodsBesides']);
|
||||
}
|
||||
@ -621,7 +621,7 @@ final class Expectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toHavePrivateMethodsBesides(): never
|
||||
public function toHavePrivateMethodsBesides(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toHavePrivateMethodsBesides']);
|
||||
}
|
||||
@ -851,7 +851,7 @@ final class Expectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toBeUsed(): never
|
||||
public function toBeUsed(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toBeUsed']);
|
||||
}
|
||||
|
||||
@ -33,14 +33,14 @@ use stdClass;
|
||||
*
|
||||
* @mixin Expectation<TValue>
|
||||
*/
|
||||
final class OppositeExpectation
|
||||
final readonly class OppositeExpectation
|
||||
{
|
||||
/**
|
||||
* Creates a new opposite expectation.
|
||||
*
|
||||
* @param Expectation<TValue> $original
|
||||
*/
|
||||
public function __construct(private readonly Expectation $original) {}
|
||||
public function __construct(private Expectation $original) {}
|
||||
|
||||
/**
|
||||
* Asserts that the value array not has the provided $keys.
|
||||
@ -510,7 +510,7 @@ final class OppositeExpectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toOnlyImplement(): never
|
||||
public function toOnlyImplement(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['not', 'toOnlyImplement']);
|
||||
}
|
||||
@ -544,7 +544,7 @@ final class OppositeExpectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toOnlyUse(): never
|
||||
public function toOnlyUse(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['not', 'toOnlyUse']);
|
||||
}
|
||||
@ -552,7 +552,7 @@ final class OppositeExpectation
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toUseNothing(): never
|
||||
public function toUseNothing(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['not', 'toUseNothing']);
|
||||
}
|
||||
@ -577,7 +577,7 @@ final class OppositeExpectation
|
||||
), is_string($targets) ? [$targets] : $targets));
|
||||
}
|
||||
|
||||
public function toOnlyBeUsedIn(): never
|
||||
public function toOnlyBeUsedIn(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['not', 'toOnlyBeUsedIn']);
|
||||
}
|
||||
@ -585,7 +585,7 @@ final class OppositeExpectation
|
||||
/**
|
||||
* Asserts that the given expectation dependency is not used.
|
||||
*/
|
||||
public function toBeUsedInNothing(): never
|
||||
public function toBeUsedInNothing(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['not', 'toBeUsedInNothing']);
|
||||
}
|
||||
|
||||
@ -166,9 +166,7 @@ if (! function_exists('it')) {
|
||||
|
||||
if (! function_exists('todo')) {
|
||||
/**
|
||||
* Adds the given todo test. Internally, this test
|
||||
* is marked as incomplete. Yet, Collision, Pest's
|
||||
* printer, will display it as a "todo" test.
|
||||
* Creates a new test that is marked as "todo".
|
||||
*
|
||||
* @return Expectable|TestCall|TestCase|mixed
|
||||
*/
|
||||
|
||||
@ -27,7 +27,7 @@ use Whoops\Exception\Inspector;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Kernel
|
||||
final readonly class Kernel
|
||||
{
|
||||
/**
|
||||
* The Kernel bootstrappers.
|
||||
@ -47,8 +47,8 @@ final class Kernel
|
||||
* Creates a new Kernel instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly Application $application,
|
||||
private readonly OutputInterface $output,
|
||||
private Application $application,
|
||||
private OutputInterface $output,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ use PHPUnit\TestRunner\TestResult\TestResult as PhpUnitTestResult;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Converter
|
||||
final readonly class Converter
|
||||
{
|
||||
/**
|
||||
* The prefix for the test suite name.
|
||||
@ -34,13 +34,13 @@ final class Converter
|
||||
/**
|
||||
* The state generator.
|
||||
*/
|
||||
private readonly StateGenerator $stateGenerator;
|
||||
private StateGenerator $stateGenerator;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the Converter.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly string $rootPath,
|
||||
private string $rootPath,
|
||||
) {
|
||||
$this->stateGenerator = new StateGenerator;
|
||||
}
|
||||
|
||||
@ -12,13 +12,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Throwable;
|
||||
use Whoops\Exception\Inspector;
|
||||
|
||||
final class Panic
|
||||
final readonly class Panic
|
||||
{
|
||||
/**
|
||||
* Creates a new Panic instance.
|
||||
*/
|
||||
private function __construct(
|
||||
private readonly Throwable $throwable
|
||||
private Throwable $throwable
|
||||
) {
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ final class TestCall
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test as "todo".
|
||||
* Marks the test as "todo".
|
||||
*/
|
||||
public function todo(// @phpstan-ignore-line
|
||||
array|string|null $note = null,
|
||||
@ -384,6 +384,34 @@ final class TestCall
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test as "work in progress".
|
||||
*/
|
||||
public function wip(// @phpstan-ignore-line
|
||||
array|string|null $note = null,
|
||||
array|string|null $assignee = null,
|
||||
array|string|null $issue = null,
|
||||
array|string|null $pr = null,
|
||||
): self {
|
||||
if ($issue !== null) {
|
||||
$this->issue($issue);
|
||||
}
|
||||
|
||||
if ($pr !== null) {
|
||||
$this->pr($pr);
|
||||
}
|
||||
|
||||
if ($assignee !== null) {
|
||||
$this->assignee($assignee);
|
||||
}
|
||||
|
||||
if ($note !== null) {
|
||||
$this->note($note);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test as "done".
|
||||
*/
|
||||
|
||||
@ -84,8 +84,7 @@ final class UsesCall
|
||||
}
|
||||
|
||||
/**
|
||||
* The directories or file where the
|
||||
* class or traits should be used.
|
||||
* The directories or file where the class or traits should be used.
|
||||
*/
|
||||
public function in(string ...$targets): self
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ use function Pest\version;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Help implements HandlesArguments
|
||||
final readonly class Help implements HandlesArguments
|
||||
{
|
||||
use Concerns\HandleArguments;
|
||||
|
||||
@ -22,7 +22,7 @@ final class Help implements HandlesArguments
|
||||
* Creates a new Plugin instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly OutputInterface $output
|
||||
private OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Init implements HandlesArguments
|
||||
final readonly class Init implements HandlesArguments
|
||||
{
|
||||
/**
|
||||
* The option the triggers the init job.
|
||||
@ -37,9 +37,9 @@ final class Init implements HandlesArguments
|
||||
* Creates a new Plugin instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly TestSuite $testSuite,
|
||||
private readonly InputInterface $input,
|
||||
private readonly OutputInterface $output
|
||||
private TestSuite $testSuite,
|
||||
private InputInterface $input,
|
||||
private OutputInterface $output
|
||||
) {
|
||||
// ..
|
||||
}
|
||||
|
||||
@ -15,15 +15,15 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class EnsureTeamCityEnabled implements ConfiguredSubscriber
|
||||
final readonly class EnsureTeamCityEnabled implements ConfiguredSubscriber
|
||||
{
|
||||
/**
|
||||
* Creates a new Configured Subscriber instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly InputInterface $input,
|
||||
private readonly OutputInterface $output,
|
||||
private readonly TestSuite $testSuite,
|
||||
private InputInterface $input,
|
||||
private OutputInterface $output,
|
||||
private TestSuite $testSuite,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,7 @@ use SebastianBergmann\RecursionContext\Context;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Exporter
|
||||
final readonly class Exporter
|
||||
{
|
||||
/**
|
||||
* The maximum number of items in an array to export.
|
||||
@ -21,7 +21,7 @@ final class Exporter
|
||||
* Creates a new Exporter instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly BaseExporter $exporter,
|
||||
private BaseExporter $exporter,
|
||||
) {
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -10,12 +10,12 @@ use Pest\Expectation;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class HigherOrderCallables
|
||||
final readonly class HigherOrderCallables
|
||||
{
|
||||
/**
|
||||
* Creates a new Higher Order Callables instances.
|
||||
*/
|
||||
public function __construct(private readonly object $target)
|
||||
public function __construct(private object $target)
|
||||
{
|
||||
// ..
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user