public function ViewEventTest::testQueryAlterEvent in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/views_event_dispatcher/tests/src/Unit/Views/ViewEventTest.php \Drupal\Tests\views_event_dispatcher\Unit\Views\ViewEventTest::testQueryAlterEvent()
Query alter event.
File
- modules/
views_event_dispatcher/ tests/ src/ Unit/ Views/ ViewEventTest.php, line 191
Class
- ViewEventTest
- Class ViewEventTest.
Namespace
Drupal\Tests\views_event_dispatcher\Unit\ViewsCode
public function testQueryAlterEvent() : void {
/** @var \Drupal\views\ViewExecutable $view */
$view = $this
->createMock(ViewExecutable::class);
/** @var \Drupal\views\Plugin\views\query\QueryPluginBase $query */
$query = $this
->createMock(QueryPluginBase::class);
views_event_dispatcher_views_query_alter($view, $query);
/** @var \Drupal\views_event_dispatcher\Event\Views\ViewsQueryAlterEvent $event */
$event = $this->manager
->getRegisteredEvent(HookEventDispatcherInterface::VIEWS_QUERY_ALTER);
self::assertSame($view, $event
->getView());
self::assertSame($query, $event
->getQuery());
}