You are here

final class FakePreprocessEventFactory in Hook Event Dispatcher 8

Class FakePreprocessEventFactory.

@package Drupal\Tests\hook_event_dispatcher\Preprocess\Helpers

Hierarchy

Expanded class hierarchy of FakePreprocessEventFactory

1 file declares its use of FakePreprocessEventFactory
PreprocessEventPassTest.php in tests/src/Unit/Preprocess/PreprocessEventPassTest.php

File

tests/src/Unit/Preprocess/Helpers/FakePreprocessEventFactory.php, line 12

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess\Helpers
View source
final class FakePreprocessEventFactory implements PreprocessEventFactoryInterface {

  /**
   * Fake hook.
   *
   * @var string
   */
  private $hook;

  /**
   * FakePreprocessEventFactory constructor.
   *
   * @param string $hook
   *   Fake hook.
   */
  public function __construct($hook) {
    $this->hook = $hook;
  }

  /**
   * Create the PreprocessEvent with the Variables object embedded.
   *
   * @param array $variables
   *   Variables.
   *
   * @return FakePreprocessEvent
   *   Created event.
   */
  public function createEvent(array &$variables) {
    return new FakePreprocessEvent(new FakeEventVariables($variables));
  }

  /**
   * {@inheritdoc}
   */
  public function getEventHook() {
    return $this->hook;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FakePreprocessEventFactory::$hook private property Fake hook.
FakePreprocessEventFactory::createEvent public function Create the PreprocessEvent with the Variables object embedded. Overrides PreprocessEventFactoryInterface::createEvent
FakePreprocessEventFactory::getEventHook public function Get the Event hook name. Overrides PreprocessEventFactoryInterface::getEventHook
FakePreprocessEventFactory::__construct public function FakePreprocessEventFactory constructor.