Drupal Test Helpers module API documentation - release 1.3.1

CacheContextsManagerStub extends CacheContextsManager

A stub of the Drupal's default ConfigFactory class.

Validates any context names by default, until they are not defined by the function stubAddContext().

Table of Contents

Properties

$stubAllowAnyContexts  : bool
A flag to accept all contexts by default, if no contexts is set manually.

Methods

__construct()  : mixed
Constructs a CacheContextsManager object.
assertValidTokens()  : mixed
{@inheritdoc}
stubAddContexts()  : mixed
Adds contexts to the valid list.
stubSetContexts()  : mixed
Sets the full list of contexts.

Properties

$stubAllowAnyContexts

A flag to accept all contexts by default, if no contexts is set manually.

protected bool $stubAllowAnyContexts

Methods

__construct()

Constructs a CacheContextsManager object.

public __construct(ContainerInterface $container[, array<string|int, string> $contexts = [] ]) : mixed
Parameters
$container : ContainerInterface

The current service container.

$contexts : array<string|int, string> = []

An array of the available cache context IDs, NULL to accept all contexts.

assertValidTokens()

{@inheritdoc}

public assertValidTokens(mixed $context_tokens) : mixed
Parameters
$context_tokens : mixed

stubAddContexts()

Adds contexts to the valid list.

public stubAddContexts(string|array<string|int, string> $contexts) : mixed
Parameters
$contexts : string|array<string|int, string>

The list of valid contexts.

stubSetContexts()

Sets the full list of contexts.

public stubSetContexts(array<string|int, string> $contexts) : mixed
Parameters
$contexts : array<string|int, string>

The list of valid contexts.


        
On this page

Search results