MailingComponentTest
extends TestCase
in package
implements
HeadlessInterface, HookInterface
uses
EntityTrait
Test the core Entity->getOptions functionality
Tags
Table of Contents
Interfaces
- HeadlessInterface
- Interface HeadlessInterface
- HookInterface
- Interface HookInterface
Properties
- $ids : array<string|int, mixed>
- Array of IDs created to support the test.
- $tablesToCleanUp : array<string|int, mixed>
- Track tables we have modified during a test.
- $testRecords : array<string|int, mixed>
- Records created which will be deleted during tearDown
Methods
- setUpHeadless() : mixed
- The setupHeadless function runs at the start of each test case, right before the headless environment reboots.
- testCacheClear() : void
- createTestEntity() : array<string|int, mixed>
- Create an entity, recording it's details for tearDown.
- setTestEntity() : void
- Set the test entity on the class for access.
- setTestEntityID() : void
Properties
$ids
Array of IDs created to support the test.
protected
array<string|int, mixed>
$ids
= []
e.g $this->ids = ['Event' => ['descriptive_key' => $eventID], 'Group' => [$groupID]];
$tablesToCleanUp
Track tables we have modified during a test.
protected
array<string|int, mixed>
$tablesToCleanUp
= []
Set up functions that add entities can register the relevant tables here for the cleanup process.
$testRecords
Records created which will be deleted during tearDown
protected
array<string|int, mixed>
$testRecords
= []
Methods
setUpHeadless()
The setupHeadless function runs at the start of each test case, right before the headless environment reboots.
public
setUpHeadless() : mixed
It should perform any necessary steps required for putting the database in a consistent baseline -- such as loading schema and extensions.
The utility \Civi\Test::headless() provides a number of helper functions
for managing this setup, and it includes optimizations to avoid redundant
setup work.
testCacheClear()
public
testCacheClear() : void
createTestEntity()
Create an entity, recording it's details for tearDown.
protected
createTestEntity(string $entity, array<string|int, mixed> $values[, string $identifier = 'default' ]) : array<string|int, mixed>
Parameters
- $entity : string
- $values : array<string|int, mixed>
- $identifier : string = 'default'
Return values
array<string|int, mixed>setTestEntity()
Set the test entity on the class for access.
protected
setTestEntity(string $entity, array<string|int, mixed> $values, string $identifier) : void
This follows the ids patter and also the api4TestTrait pattern.
Parameters
- $entity : string
- $values : array<string|int, mixed>
- $identifier : string
setTestEntityID()
protected
setTestEntityID(string $entity, int $id, string $identifier) : void
Parameters
- $entity : string
- $id : int
- $identifier : string