From 2070538fd3cf734e1646c91e31397ac6c057b4b6 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Sun, 28 Apr 2024 12:02:42 +0100 Subject: [PATCH] chore: fixes test suite --- src/PendingCalls/AfterEachCall.php | 2 +- src/PendingCalls/BeforeEachCall.php | 2 +- src/PendingCalls/Concerns/Describable.php | 3 +- tests/.snapshots/success.txt | 51 +++-------------------- tests/Features/Deprecated.php | 6 +-- tests/Pest.php | 2 + tests/Visual/Parallel.php | 2 +- 7 files changed, 14 insertions(+), 54 deletions(-) diff --git a/src/PendingCalls/AfterEachCall.php b/src/PendingCalls/AfterEachCall.php index a20157e9..8ccc8a46 100644 --- a/src/PendingCalls/AfterEachCall.php +++ b/src/PendingCalls/AfterEachCall.php @@ -54,7 +54,7 @@ final class AfterEachCall $proxies = $this->proxies; $afterEachTestCase = ChainableClosure::boundWhen( - fn (): bool => is_null($describing) || $this->__describing === $describing, // @phpstan-ignore-line + fn (): bool => is_null($describing) || $this->__describing === $describing, ChainableClosure::bound(fn () => $proxies->chain($this), $this->closure)->bindTo($this, self::class), // @phpstan-ignore-line )->bindTo($this, self::class); diff --git a/src/PendingCalls/BeforeEachCall.php b/src/PendingCalls/BeforeEachCall.php index 2be5510d..a14c03a0 100644 --- a/src/PendingCalls/BeforeEachCall.php +++ b/src/PendingCalls/BeforeEachCall.php @@ -69,7 +69,7 @@ final class BeforeEachCall }; $beforeEachTestCase = ChainableClosure::boundWhen( - fn (): bool => is_null($describing) || $this->__describing === $describing, // @phpstan-ignore-line + fn (): bool => is_null($describing) || $this->__describing === $describing, ChainableClosure::bound(fn () => $testCaseProxies->chain($this), $this->closure)->bindTo($this, self::class), // @phpstan-ignore-line )->bindTo($this, self::class); diff --git a/src/PendingCalls/Concerns/Describable.php b/src/PendingCalls/Concerns/Describable.php index 13e321b5..e70bcbb3 100644 --- a/src/PendingCalls/Concerns/Describable.php +++ b/src/PendingCalls/Concerns/Describable.php @@ -10,8 +10,7 @@ namespace Pest\PendingCalls\Concerns; trait Describable { /** - * Note: this is property is not used; however, - * it gets added automatically by rector php. + * Note: this is property is not used; however, it gets added automatically by rector php. */ public string $__describing; diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 88926888..6781bec7 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -170,9 +170,9 @@ ✓ it is a test ✓ it uses correct parent class - FAIL Tests\Features\Deprecated - ! deprecated → str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated // tests/Features/Deprecated.php:6 - ⨯ user deprecated + DEPR Tests\Features\Deprecated + ! deprecated → str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated // tests/Features/Deprecated.php:4 + ! user deprecated → Since foo 1.0: This is a deprecation description // tests/Features/Deprecated.php:10 PASS Tests\Features\Describe - 5 todos ✓ before each @@ -1415,8 +1415,8 @@ ✓ junit output - junit with parallel → Not working yet - FAIL Tests\Visual\Parallel - ⨯ parallel + PASS Tests\Visual\Parallel + ✓ parallel ✓ a parallel test can extend another test with same name PASS Tests\Visual\SingleTestOrDirectory @@ -1439,44 +1439,5 @@ WARN Tests\Visual\Version - visual snapshot of help command output - ──────────────────────────────────────────────────────────────────────────── - FAILED Tests\Features\Deprecated > user deprecated Error - Call to undefined function trigger_deprecation() - at tests/Features/Deprecated.php:12 - 8▕ expect(true)->toBeTrue(); - 9▕ }); - 10▕ - 11▕ test('user deprecated', function () { - ➜ 12▕ trigger_deprecation('foo', '1.0', 'This is a deprecation description'); - 13▕ - 14▕ expect(true)->toBeTrue(); - 15▕ }); - 16▕ - - 1 tests/Features/Deprecated.php:12 - - ──────────────────────────────────────────────────────────────────────────── - FAILED Tests\Visual\Parallel > parallel - Expected: \n - ...............sssssss......................................................\n - ...............................................................s....!⨯......\n - ... (36 more lines) - - To contain: Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 1017 passed (2483 assertions) - - at tests/Visual/Parallel.php:19 - 15▕ }; - 16▕ - 17▕ test('parallel', function () use ($run) { - 18▕ expect($run('--exclude-group=integration')) - ➜ 19▕ ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 1017 passed (2483 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: 1 deprecated, 2 failed, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 1030 passed (2518 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 1031 passed (2520 assertions) \ No newline at end of file diff --git a/tests/Features/Deprecated.php b/tests/Features/Deprecated.php index 936aee5a..02ae11f8 100644 --- a/tests/Features/Deprecated.php +++ b/tests/Features/Deprecated.php @@ -1,7 +1,5 @@ toBeTrue(); }); diff --git a/tests/Pest.php b/tests/Pest.php index 6f40b03e..2236c650 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -3,6 +3,8 @@ use Tests\CustomTestCase\CustomTestCase; use Tests\CustomTestCaseInSubFolders\SubFolder\SubFolder\CustomTestCaseInSubFolder; +error_reporting(E_ALL); + $GLOBALS['__PEST_INTERNAL_TEST_SUITE'] = true; uses(CustomTestCaseInSubFolder::class)->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder'); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 8a71ccf8..0d8fca86 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, 16 skipped, 1017 passed (2483 assertions)') + ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 1017 passed (2488 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows();