mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
in the event of no class name, make one on the fly as an escape hatch
This commit is contained in:
@ -12,6 +12,7 @@ use Pest\Datasets;
|
|||||||
use Pest\Exceptions\ShouldNotHappen;
|
use Pest\Exceptions\ShouldNotHappen;
|
||||||
use Pest\Support\HigherOrderMessageCollection;
|
use Pest\Support\HigherOrderMessageCollection;
|
||||||
use Pest\Support\NullClosure;
|
use Pest\Support\NullClosure;
|
||||||
|
use Pest\Support\Str;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
@ -197,6 +198,11 @@ final class TestCaseFactory
|
|||||||
$namespace = implode('\\', $partsFQN);
|
$namespace = implode('\\', $partsFQN);
|
||||||
$baseClass = sprintf('\%s', $this->class);
|
$baseClass = sprintf('\%s', $this->class);
|
||||||
|
|
||||||
|
if (empty(trim($className))) {
|
||||||
|
$className = 'InvalidTestName' . Str::random();
|
||||||
|
$classFQN .= $className;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eval("
|
eval("
|
||||||
namespace $namespace;
|
namespace $namespace;
|
||||||
|
|||||||
Reference in New Issue
Block a user