Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MockBuilder.php

function MockBuilder::getMock

Creates a mock object using a fluent interface.

@psalm-return MockObject&MockedType

Throws

ClassIsEnumerationException

ClassIsFinalException

ClassIsReadonlyException

DuplicateMethodException

InvalidArgumentException

InvalidMethodNameException

NameAlreadyInUseException

OriginalConstructorInvocationRequiredException

ReflectionException

RuntimeException

UnknownTypeException

File

vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php, line 94

Class

MockBuilder
@psalm-template MockedType

Namespace

PHPUnit\Framework\MockObject

Code

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;
}
RSS feed
Powered by Drupal