You are here

public function ViewDataEventTest::testViewsDataEvent in Hook Event Dispatcher 8

ViewsDataEvent test.

File

tests/src/Unit/Views/ViewDataEventTest.php, line 42

Class

ViewDataEventTest
Class ViewDataEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Views

Code

public function testViewsDataEvent() {
  $data = [
    'test' => [
      'test_array_data',
    ],
  ];
  $this->manager
    ->setEventCallbacks([
    HookEventDispatcherInterface::VIEWS_DATA => function (ViewsDataEvent $event) use ($data) {
      $event
        ->addData($data);
    },
  ]);
  $result = hook_event_dispatcher_views_data();
  self::assertSame($data, $result);
}