function TestCase::createMock
Creates a mock object for the specified interface or class.
@psalm-template RealInstanceType of object
@psalm-param class-string<RealInstanceType> $originalClassName
@psalm-return MockObject&RealInstanceType
Throws
6 calls to TestCase::createMock()
- CompoundConstraintTestCase::createContext in vendor/
symfony/ validator/ Test/ CompoundConstraintTestCase.php - ConstraintValidatorTestCase::createContext in vendor/
symfony/ validator/ Test/ ConstraintValidatorTestCase.php - TestCase::createConfiguredMock in vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php - Creates (and configures) a mock object for the specified interface or class.
- TransportFactoryTestCase::getClient in vendor/
symfony/ mailer/ Test/ TransportFactoryTestCase.php - TransportFactoryTestCase::getDispatcher in vendor/
symfony/ mailer/ Test/ TransportFactoryTestCase.php
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php, line 1284
Class
- TestCase
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\FrameworkCode
protected function createMock(string $originalClassName) : MockObject {
$mock = (new MockGenerator())->testDouble($originalClassName, true, callOriginalConstructor: false, callOriginalClone: false, cloneArguments: false, allowMockingUnknownTypes: false);
assert($mock instanceof $originalClassName);
assert($mock instanceof MockObject);
$this->registerMockObject($mock);
Event\Facade::emitter()->testCreatedMockObject($originalClassName);
return $mock;
}