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:
@ -3,6 +3,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Rector\Config\RectorConfig;
|
use Rector\Config\RectorConfig;
|
||||||
|
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
|
||||||
|
|
||||||
return RectorConfig::configure()
|
return RectorConfig::configure()
|
||||||
->withPaths([
|
->withPaths([
|
||||||
@ -10,6 +11,7 @@ return RectorConfig::configure()
|
|||||||
])
|
])
|
||||||
->withSkip([
|
->withSkip([
|
||||||
__DIR__.'/src/Plugins/Parallel/Paratest/WrapperRunner.php',
|
__DIR__.'/src/Plugins/Parallel/Paratest/WrapperRunner.php',
|
||||||
|
ReturnNeverTypeRector::class,
|
||||||
])
|
])
|
||||||
->withPreparedSets(
|
->withPreparedSets(
|
||||||
deadCode: true,
|
deadCode: true,
|
||||||
|
|||||||
@ -12,13 +12,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class BootKernelDump implements Bootstrapper
|
final readonly class BootKernelDump implements Bootstrapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new Boot Kernel Dump instance.
|
* Creates a new Boot Kernel Dump instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
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',
|
'8abdad6413329c6fe0d7d44a8b9926e390af32c0b3123f3720bb9c5bbc6fbb7e' => 'TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php',
|
||||||
'43883b7e5811886cf3731c8ed6304d5a77078d9731e1e505abc2da36bde19f3e' => 'TextUI/TestSuiteFilterProcessor.php',
|
'43883b7e5811886cf3731c8ed6304d5a77078d9731e1e505abc2da36bde19f3e' => 'TextUI/TestSuiteFilterProcessor.php',
|
||||||
'357d5cd7007f8559b26e1b8cdf43bb6fb15b51b79db981779da6f31b7ec39dad' => 'Event/Value/ThrowableBuilder.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
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class BootSubscribers implements Bootstrapper
|
final readonly class BootSubscribers implements Bootstrapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The list of Subscribers.
|
* The list of Subscribers.
|
||||||
@ -31,7 +31,7 @@ final class BootSubscribers implements Bootstrapper
|
|||||||
* Creates a new instance of the Boot Subscribers.
|
* Creates a new instance of the Boot Subscribers.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Container $container,
|
private Container $container,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -11,13 +11,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class BootView implements Bootstrapper
|
final readonly class BootView implements Bootstrapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the Boot View.
|
* Creates a new instance of the Boot View.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly OutputInterface $output
|
private OutputInterface $output
|
||||||
) {
|
) {
|
||||||
// ..
|
// ..
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Collision;
|
namespace Pest\Collision;
|
||||||
|
|
||||||
use NunoMaduro\Collision\Adapters\Phpunit\TestResult;
|
use NunoMaduro\Collision\Adapters\Phpunit\TestResult;
|
||||||
use Pest\Configuration\Context;
|
use Pest\Configuration\Project;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
use function Termwind\render;
|
use function Termwind\render;
|
||||||
@ -46,15 +46,15 @@ final class Events
|
|||||||
'prs' => $prs,
|
'prs' => $prs,
|
||||||
] = $context;
|
] = $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);
|
$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);
|
$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(
|
$assigneesDescription = array_map(fn (string $assignee): string => sprintf(
|
||||||
'<a href="%s">@%s</a>',
|
'<a href="%s">@%s</a>',
|
||||||
sprintf($link, $assignee),
|
sprintf($link, $assignee),
|
||||||
|
|||||||
@ -8,13 +8,15 @@ use Pest\PendingCalls\UsesCall;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
*
|
||||||
|
* @mixin UsesCall
|
||||||
*/
|
*/
|
||||||
final class Configuration
|
final readonly class Configuration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The filename of the configuration.
|
* The filename of the configuration.
|
||||||
*/
|
*/
|
||||||
private readonly string $filename;
|
private string $filename;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new configuration instance.
|
* 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
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Context
|
final class Project
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The assignees link.
|
* The assignees link.
|
||||||
@ -36,7 +36,7 @@ final class Context
|
|||||||
private static ?self $instance = null;
|
private static ?self $instance = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the context.
|
* Creates a new instance of the project.
|
||||||
*/
|
*/
|
||||||
public static function getInstance(): self
|
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
|
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
|
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
|
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
|
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->issues = $issues;
|
||||||
$this->prs = $prs;
|
$this->prs = $prs;
|
||||||
@ -9,7 +9,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Help
|
final readonly class Help
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The Command messages.
|
* The Command messages.
|
||||||
@ -27,7 +27,7 @@ final class Help
|
|||||||
/**
|
/**
|
||||||
* Creates a new Console Command instance.
|
* 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
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Thanks
|
final readonly class Thanks
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The support options.
|
* The support options.
|
||||||
@ -33,8 +33,8 @@ final class Thanks
|
|||||||
* Creates a new Console Command instance.
|
* Creates a new Console Command instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly InputInterface $input,
|
private InputInterface $input,
|
||||||
private readonly OutputInterface $output
|
private OutputInterface $output
|
||||||
) {
|
) {
|
||||||
// ..
|
// ..
|
||||||
}
|
}
|
||||||
|
|||||||
@ -605,7 +605,7 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toHavePublicMethodsBesides(): never
|
public function toHavePublicMethodsBesides(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['toHavePublicMethodsBesides']);
|
throw InvalidExpectation::fromMethods(['toHavePublicMethodsBesides']);
|
||||||
}
|
}
|
||||||
@ -613,7 +613,7 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toHaveProtectedMethodsBesides(): never
|
public function toHaveProtectedMethodsBesides(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['toHaveProtectedMethodsBesides']);
|
throw InvalidExpectation::fromMethods(['toHaveProtectedMethodsBesides']);
|
||||||
}
|
}
|
||||||
@ -621,7 +621,7 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toHavePrivateMethodsBesides(): never
|
public function toHavePrivateMethodsBesides(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['toHavePrivateMethodsBesides']);
|
throw InvalidExpectation::fromMethods(['toHavePrivateMethodsBesides']);
|
||||||
}
|
}
|
||||||
@ -851,7 +851,7 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toBeUsed(): never
|
public function toBeUsed(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['toBeUsed']);
|
throw InvalidExpectation::fromMethods(['toBeUsed']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,14 +33,14 @@ use stdClass;
|
|||||||
*
|
*
|
||||||
* @mixin Expectation<TValue>
|
* @mixin Expectation<TValue>
|
||||||
*/
|
*/
|
||||||
final class OppositeExpectation
|
final readonly class OppositeExpectation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new opposite expectation.
|
* Creates a new opposite expectation.
|
||||||
*
|
*
|
||||||
* @param Expectation<TValue> $original
|
* @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.
|
* Asserts that the value array not has the provided $keys.
|
||||||
@ -510,7 +510,7 @@ final class OppositeExpectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toOnlyImplement(): never
|
public function toOnlyImplement(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['not', 'toOnlyImplement']);
|
throw InvalidExpectation::fromMethods(['not', 'toOnlyImplement']);
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ final class OppositeExpectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toOnlyUse(): never
|
public function toOnlyUse(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['not', 'toOnlyUse']);
|
throw InvalidExpectation::fromMethods(['not', 'toOnlyUse']);
|
||||||
}
|
}
|
||||||
@ -552,7 +552,7 @@ final class OppositeExpectation
|
|||||||
/**
|
/**
|
||||||
* Not supported.
|
* Not supported.
|
||||||
*/
|
*/
|
||||||
public function toUseNothing(): never
|
public function toUseNothing(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['not', 'toUseNothing']);
|
throw InvalidExpectation::fromMethods(['not', 'toUseNothing']);
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ final class OppositeExpectation
|
|||||||
), is_string($targets) ? [$targets] : $targets));
|
), is_string($targets) ? [$targets] : $targets));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toOnlyBeUsedIn(): never
|
public function toOnlyBeUsedIn(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['not', 'toOnlyBeUsedIn']);
|
throw InvalidExpectation::fromMethods(['not', 'toOnlyBeUsedIn']);
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ final class OppositeExpectation
|
|||||||
/**
|
/**
|
||||||
* Asserts that the given expectation dependency is not used.
|
* Asserts that the given expectation dependency is not used.
|
||||||
*/
|
*/
|
||||||
public function toBeUsedInNothing(): never
|
public function toBeUsedInNothing(): void
|
||||||
{
|
{
|
||||||
throw InvalidExpectation::fromMethods(['not', 'toBeUsedInNothing']);
|
throw InvalidExpectation::fromMethods(['not', 'toBeUsedInNothing']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,9 +166,7 @@ if (! function_exists('it')) {
|
|||||||
|
|
||||||
if (! function_exists('todo')) {
|
if (! function_exists('todo')) {
|
||||||
/**
|
/**
|
||||||
* Adds the given todo test. Internally, this test
|
* Creates a new test that is marked as "todo".
|
||||||
* is marked as incomplete. Yet, Collision, Pest's
|
|
||||||
* printer, will display it as a "todo" test.
|
|
||||||
*
|
*
|
||||||
* @return Expectable|TestCall|TestCase|mixed
|
* @return Expectable|TestCall|TestCase|mixed
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -27,7 +27,7 @@ use Whoops\Exception\Inspector;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Kernel
|
final readonly class Kernel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The Kernel bootstrappers.
|
* The Kernel bootstrappers.
|
||||||
@ -47,8 +47,8 @@ final class Kernel
|
|||||||
* Creates a new Kernel instance.
|
* Creates a new Kernel instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Application $application,
|
private Application $application,
|
||||||
private readonly OutputInterface $output,
|
private OutputInterface $output,
|
||||||
) {
|
) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ use PHPUnit\TestRunner\TestResult\TestResult as PhpUnitTestResult;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Converter
|
final readonly class Converter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The prefix for the test suite name.
|
* The prefix for the test suite name.
|
||||||
@ -34,13 +34,13 @@ final class Converter
|
|||||||
/**
|
/**
|
||||||
* The state generator.
|
* The state generator.
|
||||||
*/
|
*/
|
||||||
private readonly StateGenerator $stateGenerator;
|
private StateGenerator $stateGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the Converter.
|
* Creates a new instance of the Converter.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly string $rootPath,
|
private string $rootPath,
|
||||||
) {
|
) {
|
||||||
$this->stateGenerator = new StateGenerator;
|
$this->stateGenerator = new StateGenerator;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,13 +12,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
use Throwable;
|
use Throwable;
|
||||||
use Whoops\Exception\Inspector;
|
use Whoops\Exception\Inspector;
|
||||||
|
|
||||||
final class Panic
|
final readonly class Panic
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new Panic instance.
|
* Creates a new Panic instance.
|
||||||
*/
|
*/
|
||||||
private function __construct(
|
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
|
public function todo(// @phpstan-ignore-line
|
||||||
array|string|null $note = null,
|
array|string|null $note = null,
|
||||||
@ -384,6 +384,34 @@ final class TestCall
|
|||||||
return $this;
|
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".
|
* Sets the test as "done".
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -84,8 +84,7 @@ final class UsesCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The directories or file where the
|
* The directories or file where the class or traits should be used.
|
||||||
* class or traits should be used.
|
|
||||||
*/
|
*/
|
||||||
public function in(string ...$targets): self
|
public function in(string ...$targets): self
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use function Pest\version;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Help implements HandlesArguments
|
final readonly class Help implements HandlesArguments
|
||||||
{
|
{
|
||||||
use Concerns\HandleArguments;
|
use Concerns\HandleArguments;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ final class Help implements HandlesArguments
|
|||||||
* Creates a new Plugin instance.
|
* Creates a new Plugin instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly OutputInterface $output
|
private OutputInterface $output
|
||||||
) {
|
) {
|
||||||
// ..
|
// ..
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Init implements HandlesArguments
|
final readonly class Init implements HandlesArguments
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The option the triggers the init job.
|
* The option the triggers the init job.
|
||||||
@ -37,9 +37,9 @@ final class Init implements HandlesArguments
|
|||||||
* Creates a new Plugin instance.
|
* Creates a new Plugin instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly TestSuite $testSuite,
|
private TestSuite $testSuite,
|
||||||
private readonly InputInterface $input,
|
private InputInterface $input,
|
||||||
private readonly OutputInterface $output
|
private OutputInterface $output
|
||||||
) {
|
) {
|
||||||
// ..
|
// ..
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,15 +15,15 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class EnsureTeamCityEnabled implements ConfiguredSubscriber
|
final readonly class EnsureTeamCityEnabled implements ConfiguredSubscriber
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new Configured Subscriber instance.
|
* Creates a new Configured Subscriber instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly InputInterface $input,
|
private InputInterface $input,
|
||||||
private readonly OutputInterface $output,
|
private OutputInterface $output,
|
||||||
private readonly TestSuite $testSuite,
|
private TestSuite $testSuite,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use SebastianBergmann\RecursionContext\Context;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class Exporter
|
final readonly class Exporter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The maximum number of items in an array to export.
|
* The maximum number of items in an array to export.
|
||||||
@ -21,7 +21,7 @@ final class Exporter
|
|||||||
* Creates a new Exporter instance.
|
* Creates a new Exporter instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly BaseExporter $exporter,
|
private BaseExporter $exporter,
|
||||||
) {
|
) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,12 @@ use Pest\Expectation;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class HigherOrderCallables
|
final readonly class HigherOrderCallables
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new Higher Order Callables instances.
|
* Creates a new Higher Order Callables instances.
|
||||||
*/
|
*/
|
||||||
public function __construct(private readonly object $target)
|
public function __construct(private object $target)
|
||||||
{
|
{
|
||||||
// ..
|
// ..
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1286,6 +1286,13 @@
|
|||||||
! user warning → This is a warning description
|
! user warning → This is a warning description
|
||||||
! a "describe" group of tests → user warning → This is a warning description
|
! a "describe" group of tests → user warning → This is a warning description
|
||||||
|
|
||||||
|
PASS Tests\Features\Wip
|
||||||
|
✓ it may have an associated assignee [@nunomaduro]
|
||||||
|
✓ it may have an associated issue #1
|
||||||
|
✓ it may have an associated PR #1
|
||||||
|
✓ it may have an associated note
|
||||||
|
// a note
|
||||||
|
|
||||||
WARN Tests\Fixtures\CollisionTest
|
WARN Tests\Fixtures\CollisionTest
|
||||||
- error
|
- error
|
||||||
- success
|
- success
|
||||||
@ -1308,7 +1315,7 @@
|
|||||||
PASS Tests\Hooks\BeforeEachTest
|
PASS Tests\Hooks\BeforeEachTest
|
||||||
✓ global beforeEach execution order
|
✓ global beforeEach execution order
|
||||||
|
|
||||||
PASS Tests\Overrides\VersionsTest
|
FAIL Tests\Overrides\VersionsTest
|
||||||
✓ versions with dataset "Runner/Filter/NameFilterIterator.php"
|
✓ versions with dataset "Runner/Filter/NameFilterIterator.php"
|
||||||
✓ versions with dataset "Runner/ResultCache/DefaultResultCache.php"
|
✓ versions with dataset "Runner/ResultCache/DefaultResultCache.php"
|
||||||
✓ versions with dataset "Runner/TestSuiteLoader.php"
|
✓ versions with dataset "Runner/TestSuiteLoader.php"
|
||||||
@ -1316,7 +1323,7 @@
|
|||||||
✓ versions with dataset "TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php"
|
✓ versions with dataset "TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php"
|
||||||
✓ versions with dataset "TextUI/TestSuiteFilterProcessor.php"
|
✓ versions with dataset "TextUI/TestSuiteFilterProcessor.php"
|
||||||
✓ versions with dataset "Event/Value/ThrowableBuilder.php"
|
✓ versions with dataset "Event/Value/ThrowableBuilder.php"
|
||||||
✓ versions with dataset "Logging/JUnit/JunitXmlLogger.php"
|
⨯ versions with dataset "Logging/JUnit/JunitXmlLogger.php"
|
||||||
|
|
||||||
PASS Tests\PHPUnit\CustomAffixes\InvalidTestName
|
PASS Tests\PHPUnit\CustomAffixes\InvalidTestName
|
||||||
✓ it runs file names like @#$%^&()-_=+.php
|
✓ it runs file names like @#$%^&()-_=+.php
|
||||||
@ -1542,8 +1549,8 @@
|
|||||||
✓ junit output
|
✓ junit output
|
||||||
- junit with parallel → Not working yet
|
- junit with parallel → Not working yet
|
||||||
|
|
||||||
PASS Tests\Visual\Parallel
|
FAIL Tests\Visual\Parallel
|
||||||
✓ parallel
|
⨯ parallel
|
||||||
✓ a parallel test can extend another test with same name
|
✓ a parallel test can extend another test with same name
|
||||||
|
|
||||||
PASS Tests\Visual\SingleTestOrDirectory
|
PASS Tests\Visual\SingleTestOrDirectory
|
||||||
@ -1566,5 +1573,45 @@
|
|||||||
|
|
||||||
WARN Tests\Visual\Version
|
WARN Tests\Visual\Version
|
||||||
- visual snapshot of help command output
|
- visual snapshot of help command output
|
||||||
|
────────────────────────────────────────────────────────────────────────────
|
||||||
|
FAILED Tests\Overrides\VersionsTest > versions with dataset "Logging/JUn…
|
||||||
|
Failed asserting that two strings are identical.
|
||||||
|
-'676273f1fe483877cf2d95c5aedbf9ae5d6a8e2f4c12d6ce716df6591e6db023'
|
||||||
|
+'01974a686eba69b5fbb87a904d936eae2176e39567616898c5b758db71d87a22'
|
||||||
|
|
||||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 28 skipped, 1085 passed (2617 assertions)
|
|
||||||
|
at tests/Overrides/VersionsTest.php:8
|
||||||
|
4▕
|
||||||
|
5▕ use Pest\Bootstrappers\BootOverrides;
|
||||||
|
6▕
|
||||||
|
7▕ test('versions', function (string $vendorPath, string $expectedHash) {
|
||||||
|
➜ 8▕ expect(hash_file('sha256', $vendorPath))->toBe($expectedHash);
|
||||||
|
9▕ })->with(function () {
|
||||||
|
10▕ foreach (BootOverrides::FILES as $hash => $file) {
|
||||||
|
11▕ $path = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
12▕ dirname(__DIR__, 2),
|
||||||
|
|
||||||
|
────────────────────────────────────────────────────────────────────────────
|
||||||
|
FAILED Tests\Visual\Parallel > parallel
|
||||||
|
Expected: \n
|
||||||
|
........ss...s............sssssss.s.........................................\n
|
||||||
|
............................................................................\n
|
||||||
|
... (40 more lines)
|
||||||
|
|
||||||
|
To contain: Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1079 passed (2597 assertions)
|
||||||
|
|
||||||
|
at tests/Visual/Parallel.php:19
|
||||||
|
15▕ };
|
||||||
|
16▕
|
||||||
|
17▕ test('parallel', function () use ($run) {
|
||||||
|
18▕ expect($run('--exclude-group=integration'))
|
||||||
|
➜ 19▕ ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1079 passed (2597 assertions)')
|
||||||
|
20▕ ->toContain('Parallel: 3 processes');
|
||||||
|
21▕ })->skipOnWindows();
|
||||||
|
22▕
|
||||||
|
23▕ test('a parallel test can extend another test with same name', function () use ($run) {
|
||||||
|
|
||||||
|
1 tests/Visual/Parallel.php:19
|
||||||
|
|
||||||
|
|
||||||
|
Tests: 2 deprecated, 2 failed, 4 warnings, 5 incomplete, 2 notices, 17 todos, 28 skipped, 1087 passed (2620 assertions)
|
||||||
@ -150,7 +150,7 @@ test('high order test with skip')
|
|||||||
dd('This should not run 5');
|
dd('This should not run 5');
|
||||||
});
|
});
|
||||||
|
|
||||||
uses(Postable::class);
|
pest()->use(Postable::class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TestCase|TestCall|Gettable
|
* @return TestCase|TestCall|Gettable
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class InheritanceTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uses(InheritanceTest::class);
|
pest()->extend(InheritanceTest::class);
|
||||||
|
|
||||||
it('is a test', function () {
|
it('is a test', function () {
|
||||||
expect(true)->toBeTrue();
|
expect(true)->toBeTrue();
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
use Pest\PendingCalls\TestCall;
|
use Pest\PendingCalls\TestCall;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
uses(Gettable::class);
|
pest()->use(Gettable::class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TestCase|TestCall|Gettable
|
* @return TestCase|TestCall|Gettable
|
||||||
|
|||||||
17
tests/Features/Wip.php
Normal file
17
tests/Features/Wip.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
it('may have an associated assignee', function () {
|
||||||
|
expect(true)->toBeTrue();
|
||||||
|
})->wip(assignee: 'nunomaduro');
|
||||||
|
|
||||||
|
it('may have an associated issue', function () {
|
||||||
|
expect(true)->toBeTrue();
|
||||||
|
})->wip(issue: 1);
|
||||||
|
|
||||||
|
it('may have an associated PR', function () {
|
||||||
|
expect(true)->toBeTrue();
|
||||||
|
})->wip(pr: 1);
|
||||||
|
|
||||||
|
it('may have an associated note', function () {
|
||||||
|
expect(true)->toBeTrue();
|
||||||
|
})->wip(note: 'a note');
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
uses()->afterEach(function () {
|
pest()->afterEach(function () {
|
||||||
expect($this)
|
expect($this)
|
||||||
->toHaveProperty('ith')
|
->toHaveProperty('ith')
|
||||||
->and($this->ith)
|
->and($this->ith)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
uses()->beforeEach(function () {
|
pest()->beforeEach(function () {
|
||||||
expect($this)
|
expect($this)
|
||||||
->toHaveProperty('baz')
|
->toHaveProperty('baz')
|
||||||
->and($this->baz)
|
->and($this->baz)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class MyCustomClassTest extends PHPUnit\Framework\TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uses(MyCustomClassTest::class);
|
pest()->extend(MyCustomClassTest::class);
|
||||||
|
|
||||||
test('custom traits can be used', function () {
|
test('custom traits can be used', function () {
|
||||||
$this->assertTrueIsTrue();
|
$this->assertTrueIsTrue();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
uses(Tests\CustomTestCase\CustomTestCase::class)->in(__DIR__);
|
pest()->use(Tests\CustomTestCase\CustomTestCase::class)->in(__DIR__);
|
||||||
|
|
||||||
test('closure was bound to CustomTestCase', function () {
|
test('closure was bound to CustomTestCase', function () {
|
||||||
$this->assertCustomTrue();
|
$this->assertCustomTrue();
|
||||||
|
|||||||
@ -16,7 +16,7 @@ abstract class MyCustomClass extends PHPUnit\Framework\TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uses(MyCustomClass::class, MyCustomTrait::class);
|
pest()->extend(MyCustomClass::class)->use(MyCustomTrait::class);
|
||||||
|
|
||||||
test('custom traits can be used', function () {
|
test('custom traits can be used', function () {
|
||||||
$this->assertTrueIsTrue();
|
$this->assertTrueIsTrue();
|
||||||
|
|||||||
@ -7,7 +7,7 @@ error_reporting(E_ALL);
|
|||||||
|
|
||||||
$GLOBALS['__PEST_INTERNAL_TEST_SUITE'] = true;
|
$GLOBALS['__PEST_INTERNAL_TEST_SUITE'] = true;
|
||||||
|
|
||||||
pest()->context()->github('pestphp/pest');
|
pest()->project()->github('pestphp/pest');
|
||||||
|
|
||||||
pest()->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder')->use(CustomTestCaseInSubFolder::class);
|
pest()->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder')->use(CustomTestCaseInSubFolder::class);
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use Pest\Exceptions\ShouldNotHappen;
|
|||||||
use Pest\Support\Container;
|
use Pest\Support\Container;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
|
|
||||||
uses()->group('container');
|
pest()->group('container');
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
$this->container = new Container;
|
$this->container = new Container;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ $run = function () {
|
|||||||
|
|
||||||
test('parallel', function () use ($run) {
|
test('parallel', function () use ($run) {
|
||||||
expect($run('--exclude-group=integration'))
|
expect($run('--exclude-group=integration'))
|
||||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1075 passed (2593 assertions)')
|
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1079 passed (2597 assertions)')
|
||||||
->toContain('Parallel: 3 processes');
|
->toContain('Parallel: 3 processes');
|
||||||
})->skipOnWindows();
|
})->skipOnWindows();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user