Drupal Test Helpers module API documentation - release 1.7.0

EntityQueryServiceStub
in package
implements QueryFactoryInterface

A stub of the Drupal's default QueryFactoryInterface class.

@package TestHelpers\DrupalServiceStubs

Table of Contents

Interfaces

QueryFactoryInterface

Properties

$executeFunctions  : array<string|int, mixed>
A list of execute functions per entity type.
$namespaces  : array<string|int, mixed>
The list of namespaces.
$stubQueryStubFactory  : EntityQueryStubFactory
An EntityQueryStubFactory factory.

Methods

__construct()  : mixed
{@inheritdoc}
get()  : mixed
{@inheritdoc}
getAggregate()  : mixed
{@inheritdoc}
stubCheckConditionsMatch()  : bool
Checks if the passed conditions matches to configured.
stubGetExecuteBaseFunction()  : mixed
Returns the base execute function closure.
stubSetExecuteHandler()  : mixed
Sets the function to handle execute calls.

Properties

$executeFunctions

A list of execute functions per entity type.

protected array<string|int, mixed> $executeFunctions

Methods

get()

{@inheritdoc}

public get(mixed $entityType, mixed $conjunction) : mixed
Parameters
$entityType : mixed
$conjunction : mixed

getAggregate()

{@inheritdoc}

public getAggregate(mixed $entityType, mixed $conjunction) : mixed
Parameters
$entityType : mixed
$conjunction : mixed

stubCheckConditionsMatch()

Checks if the passed conditions matches to configured.

public stubCheckConditionsMatch(ConditionInterface $conditionsExpected[, bool $onlyListed = false ][, bool $throwErrors = true ]) : bool
Parameters
$conditionsExpected : ConditionInterface

The expected conditions.

$onlyListed : bool = false

Return FALSE if class contains more conditions than expected.

$throwErrors : bool = true

Enables throwing notice errors when matching fails, with the explanation what exactly doesn't match.

Return values
bool —

TRUE if matches, FALSE if not matches.

stubGetExecuteBaseFunction()

Returns the base execute function closure.

public static stubGetExecuteBaseFunction() : mixed

stubSetExecuteHandler()

Sets the function to handle execute calls.

public stubSetExecuteHandler(callable $function[, string $entityTypeId = 'all' ]) : mixed

You can call $this->stubExecuteBase() in your custom callback function to execute the base stub behavior for the query.

Parameters
$function : callable

The execute function.

$entityTypeId : string = 'all'

The entity type to attach, all entity types by default.


        
On this page

Search results