You are here

public function PreprocessModuleTest::testPreprocessHook in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/tests/src/Unit/PreprocessModuleTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\PreprocessModuleTest::testPreprocessHook()

Preprocess hook test.

File

modules/preprocess_event_dispatcher/tests/src/Unit/PreprocessModuleTest.php, line 39

Class

PreprocessModuleTest
Class PreprocessModuleTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

public function testPreprocessHook() : void {
  $hook = $expectedHook = 'test';
  $variables = [
    'some' => 'variables',
  ];
  $this->service
    ->expects('createAndDispatchKnownEvents')
    ->once()
    ->with($hook, $variables);
  preprocess_event_dispatcher_preprocess($variables, $hook);

  // Just test something so PHPUnit does not complain about no assertions,
  // while Mockery asserts the service being called.
  self::assertSame($expectedHook, $hook);
}