mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 18:27:23 +01:00
Merge pull request #216 from owenvoke/bugfix/depends
fix(depends): resolve issue with dependency names
This commit is contained in:
@ -95,7 +95,11 @@ final class TestCall
|
|||||||
$className = $this->testCaseFactory->getClassName();
|
$className = $this->testCaseFactory->getClassName();
|
||||||
|
|
||||||
$tests = array_map(function (string $test) use ($className): ExecutionOrderDependency {
|
$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);
|
}, $tests);
|
||||||
|
|
||||||
$this->testCaseFactory
|
$this->testCaseFactory
|
||||||
|
|||||||
@ -392,10 +392,12 @@
|
|||||||
PASS Tests\Features\Depends
|
PASS Tests\Features\Depends
|
||||||
✓ first
|
✓ first
|
||||||
✓ second
|
✓ second
|
||||||
|
✓ it asserts true is true
|
||||||
✓ depends
|
✓ depends
|
||||||
✓ depends with ...params
|
✓ depends with ...params
|
||||||
✓ depends with defined arguments
|
✓ depends with defined arguments
|
||||||
✓ depends run test only once
|
✓ depends run test only once
|
||||||
|
✓ depends works with the correct test name
|
||||||
|
|
||||||
Tests: 7 skipped, 233 passed
|
Tests: 7 skipped, 235 passed
|
||||||
|
|
||||||
@ -32,3 +32,7 @@ test('depends with defined arguments', function (string $first, string $second)
|
|||||||
test('depends run test only once', function () use (&$runCounter) {
|
test('depends run test only once', function () use (&$runCounter) {
|
||||||
expect($runCounter)->toBe(2);
|
expect($runCounter)->toBe(2);
|
||||||
})->depends('first', 'second');
|
})->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');
|
||||||
|
|||||||
Reference in New Issue
Block a user