diff --git a/src/PendingCalls/DescribeCall.php b/src/PendingCalls/DescribeCall.php index f1e503ee..dc8e5e4f 100644 --- a/src/PendingCalls/DescribeCall.php +++ b/src/PendingCalls/DescribeCall.php @@ -65,6 +65,6 @@ final class DescribeCall $beforeEachCall->describing = $this->description; - return $beforeEachCall->{$name}(...$arguments); + return $beforeEachCall->{$name}(...$arguments); // @phpstan-ignore-line } } diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 649cdffd..76de51f5 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -345,9 +345,9 @@ final class TestCall */ public function __destruct() { - if ($this->describing) { - $this->testCaseMethod->description = '`'.$this->describing.'` '.$this->testCaseMethod->description; + if (! is_null($this->describing)) { $this->testCaseMethod->describing = $this->describing; + $this->testCaseMethod->description = sprintf('`%s` > %s', $this->describing, $this->testCaseMethod->description); } $this->testSuite->tests->set($this->testCaseMethod); diff --git a/src/Repositories/BeforeEachRepository.php b/src/Repositories/BeforeEachRepository.php index 3a923df7..5f6072e7 100644 --- a/src/Repositories/BeforeEachRepository.php +++ b/src/Repositories/BeforeEachRepository.php @@ -29,11 +29,9 @@ final class BeforeEachRepository $beforeEachTestCall = ChainableClosure::unbound($fromBeforeEachTestCall, $beforeEachTestCall); $beforeEachTestCase = ChainableClosure::bound($fromBeforeEachTestCase, $beforeEachTestCase)->bindTo($beforeEachCall, $beforeEachCall::class); + assert($beforeEachTestCase instanceof Closure); } - assert($beforeEachTestCall instanceof Closure); - assert($beforeEachTestCase instanceof Closure); - $this->state[$filename] = [$beforeEachTestCall, $beforeEachTestCase]; } diff --git a/tests/.snapshots/todo.txt b/tests/.snapshots/todo.txt index 1d506b46..84a117aa 100644 --- a/tests/.snapshots/todo.txt +++ b/tests/.snapshots/todo.txt @@ -7,6 +7,13 @@ TODO Tests\Features\DatasetsTests - 1 todo ↓ forbids to define tests in Datasets dirs and Datasets.php files + TODO Tests\Features\Describe - 5 todos + ↓ todo + ↓ todo on hook > should not fail + ↓ todo on hook > should run + ↓ todo on describe > should not fail + ↓ todo on describe > should run + TODO Tests\Features\Todo - 3 todos ↓ something todo later ↓ something todo later chained @@ -15,4 +22,4 @@ PASS Tests\CustomTestCase\ExecutedTest ✓ that gets executed - Tests: 8 todos, 1 passed (1 assertions) + Tests: 13 todos, 1 passed (1 assertions)