From e2d360b1b58810a38447d142d7b4bb2ddc61924b Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 3 Sep 2024 14:09:03 +0100 Subject: [PATCH] chore: adjusts tests --- rector.php | 2 + src/Bootstrappers/BootKernelDump.php | 4 +- src/Bootstrappers/BootOverrides.php | 2 +- src/Bootstrappers/BootSubscribers.php | 4 +- src/Bootstrappers/BootView.php | 4 +- src/Collision/Events.php | 8 +-- src/Configuration.php | 22 +++++-- .../{Context.php => Project.php} | 16 +++--- src/Console/Help.php | 4 +- src/Console/Thanks.php | 6 +- src/Expectation.php | 8 +-- src/Expectations/OppositeExpectation.php | 14 ++--- src/Functions.php | 4 +- src/Kernel.php | 6 +- src/Logging/Converter.php | 6 +- src/Panic.php | 4 +- src/PendingCalls/TestCall.php | 30 +++++++++- src/PendingCalls/UsesCall.php | 3 +- src/Plugins/Help.php | 4 +- src/Plugins/Init.php | 8 +-- src/Subscribers/EnsureTeamCityEnabled.php | 8 +-- src/Support/Exporter.php | 4 +- src/Support/HigherOrderCallables.php | 4 +- tests/.snapshots/success.txt | 57 +++++++++++++++++-- tests/Features/After.php | 2 +- tests/Features/DependsInheritance.php | 2 +- tests/Features/DescriptionLess.php | 2 +- tests/Features/Wip.php | 17 ++++++ tests/Hooks/AfterEachTest.php | 2 +- tests/Hooks/BeforeEachTest.php | 2 +- .../FolderWithAn@/ExampleTest.php | 2 +- .../CustomTestCase/UsesPerDirectory.php | 2 +- .../SubFolder2/UsesPerFile.php | 2 +- tests/Pest.php | 2 +- tests/Unit/Support/Container.php | 2 +- tests/Visual/Parallel.php | 2 +- 36 files changed, 187 insertions(+), 84 deletions(-) rename src/Configuration/{Context.php => Project.php} (84%) create mode 100644 tests/Features/Wip.php diff --git a/rector.php b/rector.php index a469dc41..191989db 100644 --- a/rector.php +++ b/rector.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; +use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector; return RectorConfig::configure() ->withPaths([ @@ -10,6 +11,7 @@ return RectorConfig::configure() ]) ->withSkip([ __DIR__.'/src/Plugins/Parallel/Paratest/WrapperRunner.php', + ReturnNeverTypeRector::class, ]) ->withPreparedSets( deadCode: true, diff --git a/src/Bootstrappers/BootKernelDump.php b/src/Bootstrappers/BootKernelDump.php index 8e7a34ee..380a1743 100644 --- a/src/Bootstrappers/BootKernelDump.php +++ b/src/Bootstrappers/BootKernelDump.php @@ -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, ) { // ... } diff --git a/src/Bootstrappers/BootOverrides.php b/src/Bootstrappers/BootOverrides.php index ef258a03..3ddabed8 100644 --- a/src/Bootstrappers/BootOverrides.php +++ b/src/Bootstrappers/BootOverrides.php @@ -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', ]; /** diff --git a/src/Bootstrappers/BootSubscribers.php b/src/Bootstrappers/BootSubscribers.php index 0be2a488..57f98e33 100644 --- a/src/Bootstrappers/BootSubscribers.php +++ b/src/Bootstrappers/BootSubscribers.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, ) {} /** diff --git a/src/Bootstrappers/BootView.php b/src/Bootstrappers/BootView.php index 680c78ce..db365b89 100644 --- a/src/Bootstrappers/BootView.php +++ b/src/Bootstrappers/BootView.php @@ -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 ) { // .. } diff --git a/src/Collision/Events.php b/src/Collision/Events.php index 0f83100f..f89976ba 100644 --- a/src/Collision/Events.php +++ b/src/Collision/Events.php @@ -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('#%s', sprintf($link, $issue), $issue), $issues); } - if (($link = Context::getInstance()->prs) !== '') { + if (($link = Project::getInstance()->prs) !== '') { $prsDescription = array_map(fn (int $pr): string => sprintf('#%s', 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( '@%s', sprintf($link, $assignee), diff --git a/src/Configuration.php b/src/Configuration.php index fd12a92f..0872c833 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -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 $arguments + */ + public function __call(string $name, array $arguments): mixed + { + return $this->uses()->$name(...$arguments); // @phpstan-ignore-line } } diff --git a/src/Configuration/Context.php b/src/Configuration/Project.php similarity index 84% rename from src/Configuration/Context.php rename to src/Configuration/Project.php index a19cabe4..21444b2d 100644 --- a/src/Configuration/Context.php +++ b/src/Configuration/Project.php @@ -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; diff --git a/src/Console/Help.php b/src/Console/Help.php index 000fb3fe..3d09d5f5 100644 --- a/src/Console/Help.php +++ b/src/Console/Help.php @@ -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) { // .. } diff --git a/src/Console/Thanks.php b/src/Console/Thanks.php index aedfb671..332c311b 100644 --- a/src/Console/Thanks.php +++ b/src/Console/Thanks.php @@ -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 ) { // .. } diff --git a/src/Expectation.php b/src/Expectation.php index d3fc3f5d..0d06cb89 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -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']); } diff --git a/src/Expectations/OppositeExpectation.php b/src/Expectations/OppositeExpectation.php index 123b658b..12fe2fd4 100644 --- a/src/Expectations/OppositeExpectation.php +++ b/src/Expectations/OppositeExpectation.php @@ -33,14 +33,14 @@ use stdClass; * * @mixin Expectation */ -final class OppositeExpectation +final readonly class OppositeExpectation { /** * Creates a new opposite expectation. * * @param Expectation $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']); } diff --git a/src/Functions.php b/src/Functions.php index 8a004e67..bcf4141b 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -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 */ diff --git a/src/Kernel.php b/src/Kernel.php index d1eb7546..fc82574c 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -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, ) { // } diff --git a/src/Logging/Converter.php b/src/Logging/Converter.php index 47d1af9a..92b67db1 100644 --- a/src/Logging/Converter.php +++ b/src/Logging/Converter.php @@ -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; } diff --git a/src/Panic.php b/src/Panic.php index 37744aa2..aca23b5e 100644 --- a/src/Panic.php +++ b/src/Panic.php @@ -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 ) { // ... } diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index ca6b163a..bab8f0eb 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -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". */ diff --git a/src/PendingCalls/UsesCall.php b/src/PendingCalls/UsesCall.php index fb7fa27e..68cb9621 100644 --- a/src/PendingCalls/UsesCall.php +++ b/src/PendingCalls/UsesCall.php @@ -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 { diff --git a/src/Plugins/Help.php b/src/Plugins/Help.php index 8c38b169..9bb1f51d 100644 --- a/src/Plugins/Help.php +++ b/src/Plugins/Help.php @@ -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 ) { // .. } diff --git a/src/Plugins/Init.php b/src/Plugins/Init.php index 0b402652..6bb92365 100644 --- a/src/Plugins/Init.php +++ b/src/Plugins/Init.php @@ -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 ) { // .. } diff --git a/src/Subscribers/EnsureTeamCityEnabled.php b/src/Subscribers/EnsureTeamCityEnabled.php index 89d4be97..0b9591d2 100644 --- a/src/Subscribers/EnsureTeamCityEnabled.php +++ b/src/Subscribers/EnsureTeamCityEnabled.php @@ -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, ) {} /** diff --git a/src/Support/Exporter.php b/src/Support/Exporter.php index ddf00c81..a486445f 100644 --- a/src/Support/Exporter.php +++ b/src/Support/Exporter.php @@ -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, ) { // ... } diff --git a/src/Support/HigherOrderCallables.php b/src/Support/HigherOrderCallables.php index b728551d..9e5bba36 100644 --- a/src/Support/HigherOrderCallables.php +++ b/src/Support/HigherOrderCallables.php @@ -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) { // .. } diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index bce78c62..12720479 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -1286,6 +1286,13 @@ ! 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 - error - success @@ -1308,7 +1315,7 @@ PASS Tests\Hooks\BeforeEachTest ✓ global beforeEach execution order - PASS Tests\Overrides\VersionsTest + FAIL Tests\Overrides\VersionsTest ✓ versions with dataset "Runner/Filter/NameFilterIterator.php" ✓ versions with dataset "Runner/ResultCache/DefaultResultCache.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/TestSuiteFilterProcessor.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 ✓ it runs file names like @#$%^&()-_=+.php @@ -1542,8 +1549,8 @@ ✓ junit output - junit with parallel → Not working yet - PASS Tests\Visual\Parallel - ✓ parallel + FAIL Tests\Visual\Parallel + ⨯ parallel ✓ a parallel test can extend another test with same name PASS Tests\Visual\SingleTestOrDirectory @@ -1566,5 +1573,45 @@ WARN Tests\Visual\Version - 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) \ No newline at end of file + 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) \ No newline at end of file diff --git a/tests/Features/After.php b/tests/Features/After.php index a64c5710..f65a54d2 100644 --- a/tests/Features/After.php +++ b/tests/Features/After.php @@ -150,7 +150,7 @@ test('high order test with skip') dd('This should not run 5'); }); -uses(Postable::class); +pest()->use(Postable::class); /** * @return TestCase|TestCall|Gettable diff --git a/tests/Features/DependsInheritance.php b/tests/Features/DependsInheritance.php index cb7842c3..fd55b7f7 100644 --- a/tests/Features/DependsInheritance.php +++ b/tests/Features/DependsInheritance.php @@ -10,7 +10,7 @@ class InheritanceTest extends TestCase } } -uses(InheritanceTest::class); +pest()->extend(InheritanceTest::class); it('is a test', function () { expect(true)->toBeTrue(); diff --git a/tests/Features/DescriptionLess.php b/tests/Features/DescriptionLess.php index 971d5cd3..0bc28720 100644 --- a/tests/Features/DescriptionLess.php +++ b/tests/Features/DescriptionLess.php @@ -3,7 +3,7 @@ use Pest\PendingCalls\TestCall; use PHPUnit\Framework\TestCase; -uses(Gettable::class); +pest()->use(Gettable::class); /** * @return TestCase|TestCall|Gettable diff --git a/tests/Features/Wip.php b/tests/Features/Wip.php new file mode 100644 index 00000000..74b31d76 --- /dev/null +++ b/tests/Features/Wip.php @@ -0,0 +1,17 @@ +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'); diff --git a/tests/Hooks/AfterEachTest.php b/tests/Hooks/AfterEachTest.php index dc7176a9..db1fa6b3 100644 --- a/tests/Hooks/AfterEachTest.php +++ b/tests/Hooks/AfterEachTest.php @@ -1,6 +1,6 @@ afterEach(function () { +pest()->afterEach(function () { expect($this) ->toHaveProperty('ith') ->and($this->ith) diff --git a/tests/Hooks/BeforeEachTest.php b/tests/Hooks/BeforeEachTest.php index 9b74ee10..78f9fa54 100644 --- a/tests/Hooks/BeforeEachTest.php +++ b/tests/Hooks/BeforeEachTest.php @@ -1,6 +1,6 @@ beforeEach(function () { +pest()->beforeEach(function () { expect($this) ->toHaveProperty('baz') ->and($this->baz) diff --git a/tests/PHPUnit/CustomAffixes/FolderWithAn@/ExampleTest.php b/tests/PHPUnit/CustomAffixes/FolderWithAn@/ExampleTest.php index 351e0612..253e16be 100644 --- a/tests/PHPUnit/CustomAffixes/FolderWithAn@/ExampleTest.php +++ b/tests/PHPUnit/CustomAffixes/FolderWithAn@/ExampleTest.php @@ -10,7 +10,7 @@ class MyCustomClassTest extends PHPUnit\Framework\TestCase } } -uses(MyCustomClassTest::class); +pest()->extend(MyCustomClassTest::class); test('custom traits can be used', function () { $this->assertTrueIsTrue(); diff --git a/tests/PHPUnit/CustomTestCase/UsesPerDirectory.php b/tests/PHPUnit/CustomTestCase/UsesPerDirectory.php index ce947929..0d337209 100644 --- a/tests/PHPUnit/CustomTestCase/UsesPerDirectory.php +++ b/tests/PHPUnit/CustomTestCase/UsesPerDirectory.php @@ -1,6 +1,6 @@ in(__DIR__); +pest()->use(Tests\CustomTestCase\CustomTestCase::class)->in(__DIR__); test('closure was bound to CustomTestCase', function () { $this->assertCustomTrue(); diff --git a/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder2/UsesPerFile.php b/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder2/UsesPerFile.php index 2aec8877..676e80f4 100644 --- a/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder2/UsesPerFile.php +++ b/tests/PHPUnit/CustomTestCaseInSubFolders/SubFolder2/UsesPerFile.php @@ -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 () { $this->assertTrueIsTrue(); diff --git a/tests/Pest.php b/tests/Pest.php index 9df1981f..69eddbdf 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -7,7 +7,7 @@ error_reporting(E_ALL); $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); diff --git a/tests/Unit/Support/Container.php b/tests/Unit/Support/Container.php index 3bb2656d..28b886a9 100644 --- a/tests/Unit/Support/Container.php +++ b/tests/Unit/Support/Container.php @@ -4,7 +4,7 @@ use Pest\Exceptions\ShouldNotHappen; use Pest\Support\Container; use Pest\TestSuite; -uses()->group('container'); +pest()->group('container'); beforeEach(function () { $this->container = new Container; diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 045d72f1..b30378b6 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -16,7 +16,7 @@ $run = function () { test('parallel', function () use ($run) { 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'); })->skipOnWindows();