function MockBuilder::getMock
Creates a mock object using a fluent interface.
@psalm-return MockObject&MockedType
Throws
OriginalConstructorInvocationRequiredException
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ MockBuilder.php, line 94
Class
- MockBuilder
- @psalm-template MockedType
Namespace
PHPUnit\Framework\MockObjectCode
public function getMock() : MockObject {
$object = $this->generator
->testDouble($this->type, true, !$this->emptyMethodsArray ? $this->methods : null, $this->constructorArgs, $this->mockClassName ?? '', $this->originalConstructor, $this->originalClone, $this->autoload, $this->cloneArguments, $this->callOriginalMethods, $this->proxyTarget, $this->allowMockingUnknownTypes, $this->returnValueGeneration);
assert($object instanceof $this->type);
assert($object instanceof MockObject);
$this->testCase
->registerMockObject($object);
return $object;
}