Documentation

ExampleSubscriberTest extends TestCase
in package
implements HeadlessInterface, EventSubscriberInterface

This is an example of a barebones test which implements `EventSubscriberInterface`. The method `getSubscribedEvents()` is used to get a list of listeners.

The underlying mechanism behind this is:

  • When booting headless Civi, CRM_Utils_System_UnitTests::initialize() looks up the active test object.
  • It uses EventScanner to check the interfaces & methods for any listeners.
Tags
group

headless

Table of Contents

Interfaces

HeadlessInterface
Interface HeadlessInterface
EventSubscriberInterface

Properties

$contact  : CRM_Contact_DAO_Contact
$tracker  : mixed

Methods

getSubscribedEvents()  : mixed
myAlterContentObject()  : void
myAlterContentParams()  : mixed
myCacheClear()  : void
myCiviApiPrepare()  : void
myCiviApiResolve()  : void
setUpHeadless()  : mixed
The setupHeadless function runs at the start of each test case, right before the headless environment reboots.
testCacheClearEvent()  : void
testGetFields()  : void
testPageOutput()  : void
setUp()  : void
tearDown()  : void

Properties

Methods

myAlterContentParams()

public myAlterContentParams(mixed &$content, mixed $context, mixed $tplName, mixed &$object) : mixed
Parameters
$content : mixed
$context : mixed
$tplName : mixed
$object : mixed

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.


        
On this page

Search results