function TestCase::createStub
Creates a test stub for the specified interface or class.
@psalm-template RealInstanceType of object
@psalm-param class-string<RealInstanceType> $originalClassName
@psalm-return Stub&RealInstanceType
Throws
1 call to TestCase::createStub()
- TestCase::createConfiguredStub in vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php - Creates (and configures) a test stub for the specified interface or class.
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php, line 2331
Class
- TestCase
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\FrameworkCode
protected static function createStub(string $originalClassName) : Stub {
$stub = (new MockGenerator())->testDouble($originalClassName, true, callOriginalConstructor: false, callOriginalClone: false, cloneArguments: false, allowMockingUnknownTypes: false);
Event\Facade::emitter()->testCreatedStub($originalClassName);
assert($stub instanceof $originalClassName);
assert($stub instanceof Stub);
return $stub;
}