public function ViewDataEventTest::testViewsDataEvent in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/views_event_dispatcher/tests/src/Unit/Views/ViewDataEventTest.php \Drupal\Tests\views_event_dispatcher\Unit\Views\ViewDataEventTest::testViewsDataEvent()
ViewsDataEvent test.
File
- modules/
views_event_dispatcher/ tests/ src/ Unit/ Views/ ViewDataEventTest.php, line 43
Class
- ViewDataEventTest
- Class ViewDataEventTest.
Namespace
Drupal\Tests\views_event_dispatcher\Unit\ViewsCode
public function testViewsDataEvent() : void {
$data = [
'test' => [
'test_array_data',
],
];
$this->manager
->setEventCallbacks([
HookEventDispatcherInterface::VIEWS_DATA => static function (ViewsDataEvent $event) use ($data) {
$event
->addData($data);
},
]);
$result = views_event_dispatcher_views_data();
self::assertSame($data, $result);
}