public function ViewDataEventTest::testViewsDataAlterEventBySet in Hook Event Dispatcher 8
ViewsDataAlterEvent by set test.
File
- tests/
src/ Unit/ Views/ ViewDataEventTest.php, line 129
Class
- ViewDataEventTest
- Class ViewDataEventTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\ViewsCode
public function testViewsDataAlterEventBySet() {
$this->manager
->setEventCallbacks([
HookEventDispatcherInterface::VIEWS_DATA_ALTER => function (ViewsDataAlterEvent $event) {
$data = $event
->getData();
$data['other'] = [
'other_data',
];
$event
->setData($data);
},
]);
$data = $expectedData = [
'test' => [
'test' => 'test_array_data',
],
];
hook_event_dispatcher_views_data_alter($data);
$expectedData['other'] = [
'other_data',
];
self::assertSame($expectedData, $data);
}