From 01143a6f84e730b4017657e4b2985e68969cddbc Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Mon, 9 Nov 2020 10:49:57 +0000 Subject: [PATCH 1/2] fix(depends): resolve issue with dependency names --- src/PendingObjects/TestCall.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PendingObjects/TestCall.php b/src/PendingObjects/TestCall.php index 34aae3fc..73f30548 100644 --- a/src/PendingObjects/TestCall.php +++ b/src/PendingObjects/TestCall.php @@ -95,7 +95,11 @@ final class TestCall $className = $this->testCaseFactory->getClassName(); $tests = array_map(function (string $test) use ($className): ExecutionOrderDependency { - return ExecutionOrderDependency::createFromDependsAnnotation($className, $test); + if (strpos($test, '::') === false) { + $test = "{$className}::{$test}"; + } + + return new ExecutionOrderDependency($test, null, ''); }, $tests); $this->testCaseFactory From bb2474ccbebbc6d73e127a9c1e2c97d4924ccd9d Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Fri, 13 Nov 2020 10:52:56 +0000 Subject: [PATCH 2/2] tests: add regression tests for depends --- tests/.snapshots/success.txt | 4 +++- tests/Features/Depends.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 94fbb5da..3a5ea963 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -392,10 +392,12 @@ PASS Tests\Features\Depends ✓ first ✓ second + ✓ it asserts true is true ✓ depends ✓ depends with ...params ✓ depends with defined arguments ✓ depends run test only once + ✓ depends works with the correct test name - Tests: 7 skipped, 233 passed + Tests: 7 skipped, 235 passed \ No newline at end of file diff --git a/tests/Features/Depends.php b/tests/Features/Depends.php index edab5956..03ef85a8 100644 --- a/tests/Features/Depends.php +++ b/tests/Features/Depends.php @@ -32,3 +32,7 @@ test('depends with defined arguments', function (string $first, string $second) test('depends run test only once', function () use (&$runCounter) { expect($runCounter)->toBe(2); })->depends('first', 'second'); + +// Regression tests. See https://github.com/pestphp/pest/pull/216 +it('asserts true is true')->assertTrue(true); +test('depends works with the correct test name')->assertTrue(true)->depends('it asserts true is true');