From a493db187307de06d8df17698c4d91c74a41ca7f Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Tue, 29 Sep 2020 21:51:28 +0200 Subject: [PATCH 1/3] Revert to original target if new target is null --- src/Support/HigherOrderMessageCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/HigherOrderMessageCollection.php b/src/Support/HigherOrderMessageCollection.php index 51d744bc..f16765e1 100644 --- a/src/Support/HigherOrderMessageCollection.php +++ b/src/Support/HigherOrderMessageCollection.php @@ -30,7 +30,7 @@ final class HigherOrderMessageCollection public function chain(object $target): void { foreach ($this->messages as $message) { - $target = $message->call($target); + $target = $message->call($target) ?? $target; } } From da82eecbaeba160244feaca43b658fa5fbea00bb Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Wed, 30 Sep 2020 21:32:31 +0200 Subject: [PATCH 2/3] Add tests to ensure working. --- tests/Features/HigherOrderTests.php | 4 ++++ tests/Features/Skip.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/Features/HigherOrderTests.php b/tests/Features/HigherOrderTests.php index ca48ed4c..77e87ce4 100644 --- a/tests/Features/HigherOrderTests.php +++ b/tests/Features/HigherOrderTests.php @@ -4,4 +4,8 @@ beforeEach()->assertTrue(true); it('proxies calls to object')->assertTrue(true); +it('is capable doing multiple assertions') + ->assertTrue(true) + ->assertFalse(false); + afterEach()->assertTrue(true); diff --git a/tests/Features/Skip.php b/tests/Features/Skip.php index b393346e..66d6fe62 100644 --- a/tests/Features/Skip.php +++ b/tests/Features/Skip.php @@ -27,3 +27,7 @@ it('do not skips with falsy closure condition') it('skips with condition and message') ->skip(true, 'skipped because foo') ->assertTrue(false); + +it('skips when skip after assertion') + ->assertTrue(true) + ->skip(); From 2336bc0f654d1da7c8df7c131de6de9ead0761e9 Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Wed, 30 Sep 2020 21:36:05 +0200 Subject: [PATCH 3/3] Update snapshots --- tests/.snapshots/success.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index fe192a07..950cdcc4 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -278,6 +278,7 @@ PASS Tests\Features\HigherOrderTests ✓ it proxies calls to object + ✓ it is capable doing multiple assertions PASS Tests\Features\It ✓ it is a test @@ -302,6 +303,7 @@ - it skips with truthy closure condition ✓ it do not skips with falsy closure condition - it skips with condition and message → skipped because foo + - it skips when skip after assertion PASS Tests\Features\Test ✓ a test @@ -383,5 +385,5 @@ ✓ depends with defined arguments ✓ depends run test only once - Tests: 6 skipped, 226 passed + Tests: 7 skipped, 227 passed \ No newline at end of file