You are here

function acsf_get_registry in Acquia Cloud Site Factory Connector 8

Same name in this branch
  1. 8 acsf.module \acsf_get_registry()
  2. 8 tests/AcsfEventsTest.php \acsf_get_registry()
Same name and namespace in other branches
  1. 8.2 acsf.module \acsf_get_registry()
  2. 8.2 tests/AcsfEventsTest.php \acsf_get_registry()

Mocks acsf_get_registry for testing.

The real function returns an array of event handlers, much the same as what this version of the function returns, except that this function returns dummy data.

Parameters

bool $include_interrupt: Whether or not to include the interrupt class, which will interrupt the event processing so that feature may be tested.

string $handler: A specific handler to return.

Return value

array An array of dummy event handlers.

4 calls to acsf_get_registry()
AcsfEvent::create in src/Event/AcsfEvent.php
Creates an event using ACSF defaults.
UnitTest::testAcsfEventExecute in tests/AcsfEventsTest.php
Tests that events get run as expected.
UnitTest::testAcsfEventHandlerIncompatibleType in tests/AcsfEventsTest.php
Tests that incompatible handler types may not be used.
UnitTest::testAcsfEventInterrupt in tests/AcsfEventsTest.php
Tests that the events system handles interrupts correctly.

File

tests/AcsfEventsTest.php, line 145
Provides PHPUnit tests for the Acsf Events system.

Code

function acsf_get_registry($include_interrupt = FALSE, $handler = NULL) {
  $classes = [
    'UnitTestDummyHandler1',
    'UnitTestDummyHandler2',
    'UnitTestDummyHandlerInterrupt',
    'UnitTestDummyHandler3',
  ];
  if (!$include_interrupt) {
    $classes = array_diff($classes, [
      'UnitTestDummyHandlerInterrupt',
    ]);
  }
  if ($handler) {
    $classes = array_intersect($classes, [
      $handler,
    ]);
  }
  $handlers = [];
  foreach ($classes as $class) {
    $handlers[] = [
      'type' => 'unit_test',
      'class' => $class,
      'path' => 'tests',
    ];
  }
  return [
    'events' => $handlers,
  ];
}