refactor: move logic into boolean method in TestCaseFactory

This commit is contained in:
Jordan Brauer
2021-06-30 09:51:49 -05:00
parent 8e22803797
commit dc75b34deb
3 changed files with 10 additions and 2 deletions

View File

@ -235,4 +235,12 @@ final class TestCaseFactory
return $classFQN;
}
/**
* Determine if the test case will receive argument input from Pest, or not.
*/
public function receivesArguments(): bool
{
return $this->dependent === true || count($this->datasets) > 0;
}
}

View File

@ -142,7 +142,7 @@ final class TestRepository
throw new TestAlreadyExist($test->filename, $test->description);
}
if ($test->dependent === false && count($test->datasets) === 0) {
if (!$test->receivesArguments()) {
$arguments = Reflection::getFunctionArguments($test->test);
if (count($arguments) > 0) {

View File

@ -580,5 +580,5 @@
✓ it is a test
✓ it uses correct parent class
Tests: 4 incompleted, 7 skipped, 363 passed
Tests: 4 incompleted, 7 skipped, 364 passed