diff --git a/src/Functions.php b/src/Functions.php index 09a65e92..465f3add 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -24,8 +24,8 @@ if (! function_exists('expect')) { * * @template TValue * - * @param TValue $value - * @return Expectation + * @param TValue|null $value + * @return Expectation */ function expect(mixed $value = null): Expectation { diff --git a/src/Pest.php b/src/Pest.php index 6def7ddc..53354955 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '2.24.0'; + return '2.24.1'; } function testDirectory(string $file = ''): string diff --git a/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap b/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap index ff54ed5e..65938bb7 100644 --- a/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap +++ b/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap @@ -1,5 +1,5 @@ - Pest Testing Framework 2.24.0. + Pest Testing Framework 2.24.1. USAGE: pest [options] diff --git a/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap index 83a38fd8..2df44e50 100644 --- a/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap +++ b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap @@ -1,3 +1,3 @@ - Pest Testing Framework 2.24.0. + Pest Testing Framework 2.24.1. diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 3abfb8d6..2c5ecebe 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -1120,17 +1120,9 @@ PASS Tests\Helpers\TestInHelpers ✓ it executes tests in the Helpers directory - PASS Tests\Hooks\AfterAllTest - ✓ global afterAll execution order - ✓ it only gets called once per file - PASS Tests\Hooks\AfterEachTest ✓ global afterEach execution order - PASS Tests\Hooks\BeforeAllTest - ✓ global beforeAll execution order - ✓ it only gets called once per file - PASS Tests\Hooks\BeforeEachTest ✓ global beforeEach execution order @@ -1360,4 +1352,4 @@ WARN Tests\Visual\Version - visual snapshot of help command output - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 966 passed (2292 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 962 passed (2280 assertions) \ No newline at end of file diff --git a/tests/Hooks/AfterAllTest.php b/tests/Hooks/AfterAllTest.php deleted file mode 100644 index fb0726a7..00000000 --- a/tests/Hooks/AfterAllTest.php +++ /dev/null @@ -1,45 +0,0 @@ -afterAll(function () { - expect($_SERVER['globalHook']) - ->toHaveProperty('afterAll') - ->and($_SERVER['globalHook']->afterAll) - ->toBe(0) - ->and($_SERVER['globalHook']->calls) - ->afterAll - ->toBe(1); - - $_SERVER['globalHook']->afterAll = 1; - $_SERVER['globalHook']->calls->afterAll++; -}); - -afterAll(function () { - expect($_SERVER['globalHook']) - ->toHaveProperty('afterAll') - ->and($_SERVER['globalHook']->afterAll) - ->toBe(1) - ->and($_SERVER['globalHook']->calls) - ->afterAll - ->toBe(2); - - $_SERVER['globalHook']->afterAll = 2; - $_SERVER['globalHook']->calls->afterAll++; -}); - -test('global afterAll execution order', function () { - expect($_SERVER['globalHook']) - ->not() - ->toHaveProperty('afterAll') - ->and($_SERVER['globalHook']->calls) - ->afterAll - ->toBe(0); -}); - -it('only gets called once per file', function () { - expect($_SERVER['globalHook']) - ->not() - ->toHaveProperty('afterAll') - ->and($_SERVER['globalHook']->calls) - ->afterAll - ->toBe(0); -}); diff --git a/tests/Hooks/BeforeAllTest.php b/tests/Hooks/BeforeAllTest.php deleted file mode 100644 index c687fbfb..00000000 --- a/tests/Hooks/BeforeAllTest.php +++ /dev/null @@ -1,55 +0,0 @@ -calls baseline. This is because -// two other tests are executed before this one due to filename ordering. -$args = $_SERVER['argv'] ?? []; -$single = (isset($args[1]) && Str::endsWith(__FILE__, $args[1])) || Parallel::isWorker(); -$offset = $single ? 0 : 2; - -uses()->beforeAll(function () use ($offset) { - expect($_SERVER['globalHook']) - ->toHaveProperty('beforeAll') - ->and($_SERVER['globalHook']->beforeAll) - ->toBe(0) - ->and($_SERVER['globalHook']->calls) - ->beforeAll - ->toBe(1 + $offset); - - $_SERVER['globalHook']->beforeAll = 1; - $_SERVER['globalHook']->calls->beforeAll++; -}); - -beforeAll(function () use ($offset) { - expect($_SERVER['globalHook']) - ->toHaveProperty('beforeAll') - ->and($_SERVER['globalHook']->beforeAll) - ->toBe(1) - ->and($_SERVER['globalHook']->calls) - ->beforeAll - ->toBe(2 + $offset); - - $_SERVER['globalHook']->beforeAll = 2; - $_SERVER['globalHook']->calls->beforeAll++; -}); - -test('global beforeAll execution order', function () use ($offset) { - expect($_SERVER['globalHook']) - ->toHaveProperty('beforeAll') - ->and($_SERVER['globalHook']->beforeAll) - ->toBe(2) - ->and($_SERVER['globalHook']->calls) - ->beforeAll - ->toBe(3 + $offset); -}); - -it('only gets called once per file', function () use ($offset) { - expect($_SERVER['globalHook']) - ->beforeAll - ->toBe(2) - ->and($_SERVER['globalHook']->calls) - ->beforeAll - ->toBe(3 + $offset); -}); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 21675d07..0828a61b 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: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 955 passed (2277 assertions)') + ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 951 passed (2265 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows();