From 3fd506e090130cda31d5cdbee1ec2859e31592dd Mon Sep 17 00:00:00 2001 From: Kristiaan Van den Eynde Date: Thu, 25 Jun 2020 13:50:44 +0200 Subject: [PATCH] interdiff --- .../src/EventSubscriber/QueryAccessSubscriber.php | 6 ++++-- .../Kernel/QueryAccess/GenericQueryAccessHandlerTest.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/modules/entity_module_test/src/EventSubscriber/QueryAccessSubscriber.php b/tests/modules/entity_module_test/src/EventSubscriber/QueryAccessSubscriber.php index c05e2c5..8bf4ab5 100644 --- a/tests/modules/entity_module_test/src/EventSubscriber/QueryAccessSubscriber.php +++ b/tests/modules/entity_module_test/src/EventSubscriber/QueryAccessSubscriber.php @@ -28,8 +28,10 @@ class QueryAccessSubscriber implements EventSubscriberInterface { * The event. */ public function onGenericQueryAccess(QueryAccessEvent $event) { - $conditions = $event->getConditions(); - $conditions->addCondition('type', 'foo'); + if (\Drupal::state()->get('test_generic_query_access')) { + $conditions = $event->getConditions(); + $conditions->addCondition('type', 'foo'); + } } /** diff --git a/tests/src/Kernel/QueryAccess/GenericQueryAccessHandlerTest.php b/tests/src/Kernel/QueryAccess/GenericQueryAccessHandlerTest.php index 4a8f1b7..857eb2e 100644 --- a/tests/src/Kernel/QueryAccess/GenericQueryAccessHandlerTest.php +++ b/tests/src/Kernel/QueryAccess/GenericQueryAccessHandlerTest.php @@ -43,6 +43,8 @@ class GenericQueryAccessHandlerTest extends EntityKernelTestBase { * Tests that entity types without a query access handler still fire events. */ public function testGenericQueryAccessHandlerEventSubscriber() { + \Drupal::state()->set('test_generic_query_access', TRUE); + $node_type_storage = $this->entityTypeManager->getStorage('node_type'); $node_type_storage->create(['type' => 'foo', 'name' => $this->randomString()])->save(); $node_type_storage->create(['type' => 'bar', 'name' => $this->randomString()])->save(); -- 2.17.1