You are here

final class FakePreprocessEventFactory in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/FakePreprocessEventFactory.php \Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers\FakePreprocessEventFactory

Class FakePreprocessEventFactory.

Hierarchy

Expanded class hierarchy of FakePreprocessEventFactory

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

File

modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/FakePreprocessEventFactory.php, line 11

Namespace

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

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

  /**
   * FakePreprocessEventFactory constructor.
   *
   * @param string $hook
   *   Fake hook.
   */
  public function __construct(string $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) : AbstractPreprocessEvent {
    return new FakePreprocessEvent(new FakeEventVariables($variables));
  }

  /**
   * {@inheritdoc}
   */
  public function getEventHook() : string {
    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.