mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 10:17:23 +01:00
feat: adds --retry option
This commit is contained in:
@ -101,7 +101,7 @@ final class TestCaseFactory
|
||||
*
|
||||
* @param array<int, TestCaseMethodFactory> $methods
|
||||
*/
|
||||
public function evaluate(string $filename, array $methods): string
|
||||
public function evaluate(string $filename, array $methods): void
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// In case Windows, strtolower drive name, like in UsesCall.
|
||||
@ -123,7 +123,7 @@ final class TestCaseFactory
|
||||
|
||||
$classFQN = 'P\\' . $relativePath;
|
||||
if (class_exists($classFQN)) {
|
||||
return $classFQN;
|
||||
return;
|
||||
}
|
||||
|
||||
$hasPrintableTestCaseClassFQN = sprintf('\%s', HasPrintableTestCaseName::class);
|
||||
@ -142,7 +142,7 @@ final class TestCaseFactory
|
||||
}
|
||||
|
||||
$methodsCode = implode('', array_map(
|
||||
fn (TestCaseMethodFactory $methodFactory) => $methodFactory->buildForEvaluation(self::$annotations),
|
||||
fn (TestCaseMethodFactory $methodFactory) => $methodFactory->buildForEvaluation($classFQN, self::$annotations),
|
||||
$methods
|
||||
));
|
||||
|
||||
@ -164,8 +164,6 @@ final class TestCaseFactory
|
||||
} catch (ParseError $caught) {
|
||||
throw new RuntimeException(sprintf('Unable to create test case for test file at %s', $filename), 1, $caught);
|
||||
}
|
||||
|
||||
return $classFQN;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,6 +8,7 @@ use Closure;
|
||||
use Pest\Datasets;
|
||||
use Pest\Exceptions\ShouldNotHappen;
|
||||
use Pest\Factories\Concerns\HigherOrderable;
|
||||
use Pest\Plugins\Retry;
|
||||
use Pest\Support\Str;
|
||||
use Pest\TestSuite;
|
||||
use PHPUnit\Framework\Assert;
|
||||
@ -107,7 +108,7 @@ final class TestCaseMethodFactory
|
||||
*
|
||||
* @param array<int, class-string> $annotationsToUse
|
||||
*/
|
||||
public function buildForEvaluation(array $annotationsToUse): string
|
||||
public function buildForEvaluation(string $classFQN, array $annotationsToUse): string
|
||||
{
|
||||
if ($this->description === null) {
|
||||
throw ShouldNotHappen::fromMessage('The test description may not be empty.');
|
||||
@ -115,6 +116,10 @@ final class TestCaseMethodFactory
|
||||
|
||||
$methodName = Str::evaluable($this->description);
|
||||
|
||||
if (Retry::$retrying && !TestSuite::getInstance()->retryTempRepository->exists(sprintf('%s::%s', $classFQN, $methodName))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$datasetsCode = '';
|
||||
$annotations = ['@test'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user