Move dependency mapping to TestCase

The `TestCaseFactory::getClassName` was removed since it can have
unexpected results when called too early, as it builds up the test class
prematurely. It is not currently used anywhere else.
This commit is contained in:
avrahamappel
2020-12-17 23:24:11 -05:00
parent f75a3ee865
commit b6e2763731
3 changed files with 20 additions and 20 deletions

View File

@ -9,7 +9,6 @@ use Pest\Factories\TestCaseFactory;
use Pest\Support\Backtrace;
use Pest\Support\NullClosure;
use Pest\TestSuite;
use PHPUnit\Framework\ExecutionOrderDependency;
use SebastianBergmann\Exporter\Exporter;
/**
@ -92,19 +91,9 @@ final class TestCall
*/
public function depends(string ...$tests): TestCall
{
$className = $this->testCaseFactory->getClassName();
$tests = array_map(function (string $test) use ($className): ExecutionOrderDependency {
if (strpos($test, '::') === false) {
$test = "{$className}::{$test}";
}
return new ExecutionOrderDependency($test, null, '');
}, $tests);
$this->testCaseFactory
->factoryProxies
->add(Backtrace::file(), Backtrace::line(), 'setDependencies', [$tests]);
->add(Backtrace::file(), Backtrace::line(), 'addDependencies', [$tests]);
return $this;
}