Drupal Test Helpers module API documentation - release 1.3.1

EntityTypeManagerStubInterface extends EntityTypeManagerInterface

The EntityTypeManagerStubFactory class.

@package TestHelpers\DrupalServiceStubs

Table of Contents

Methods

stubGetOrCreateHandler()  : mixed
Creates a new hanlder, or return exists one.
stubGetOrCreateStorage()  : MockObject
Creates a new entity type storage, or return exists one.
stubReset()  : void
Resets the stub and clears all storages.
stubSetDefinition()  : mixed
Sets the definition to stub.

Methods

stubGetOrCreateHandler()

Creates a new hanlder, or return exists one.

public stubGetOrCreateHandler(string $handlerType, string $entityTypeId[, object|null $handler = NULL ][, mixed $forceOverride = FALSE ]) : mixed
Parameters
$handlerType : string

The handler type.

$entityTypeId : string

The entity type id.

$handler : object|null = NULL

The hanlder object.

$forceOverride : mixed = FALSE

Forces overriding of already existed one.

Return values
mixed

The handler.

stubGetOrCreateStorage()

Creates a new entity type storage, or return exists one.

public stubGetOrCreateStorage(string $entityClass[, object|null $storageInstanceOrAnnotation = NULL ][, bool $forceOverride = NULL ][, array<string|int, mixed> $storageOptions = NULL ]) : MockObject
Parameters
$entityClass : string

The entity class.

$storageInstanceOrAnnotation : object|null = NULL

The storage object.

$forceOverride : bool = NULL

Forces overriding of already existed one.

$storageOptions : array<string|int, mixed> = NULL

A list of options to pass to the storage initialization. Acts only once if the storage is not initialized yet.

  • skipPrePostSave: a flag to use direct save on the storage without calling preSave and postSave functions. Can be useful if that functions have dependencies which hard to mock.
  • fields: a list of custom field types to use, like 'integer', 'string', 'entity_reference'. Only core field types are supported.
  • constructorArguments: additional arguments to the constructor.
Return values
MockObject

The mocked Entity Storage Stub.

stubSetDefinition()

Sets the definition to stub.

public stubSetDefinition(string $pluginId[, object|null $definition = NULL ][, mixed $forceOverride = FALSE ]) : mixed
Parameters
$pluginId : string

The plugin id.

$definition : object|null = NULL

The definition.

$forceOverride : mixed = FALSE

Forces override of already setted definition.

Return values
mixed

The definition.


        
On this page

Search results