X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FKernelTests%2FCore%2FEntity%2FConfigEntityQueryTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FKernelTests%2FCore%2FEntity%2FConfigEntityQueryTest.php;h=8dc101a4659e9754260b385e5e74b614fc011b92;hp=87ba10480ff7f038a8bda6bee43a6fb8c7dec8ad;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/web/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 87ba10480..8dc101a46 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -572,6 +572,33 @@ class ConfigEntityQueryTest extends KernelTestBase { ->condition('*.level1.level2', 41) ->execute(); $this->assertResults([]); + // Make sure that "IS NULL" and "IS NOT NULL" work correctly with + // array-valued fields/keys. + $all = ['1', '2', '3', '4', '5']; + $this->queryResults = $this->factory->get('config_query_test') + ->exists('array.level1.level2') + ->execute(); + $this->assertResults($all); + $this->queryResults = $this->factory->get('config_query_test') + ->exists('array.level1') + ->execute(); + $this->assertResults($all); + $this->queryResults = $this->factory->get('config_query_test') + ->exists('array') + ->execute(); + $this->assertResults($all); + $this->queryResults = $this->factory->get('config_query_test') + ->notExists('array.level1.level2') + ->execute(); + $this->assertResults([]); + $this->queryResults = $this->factory->get('config_query_test') + ->notExists('array.level1') + ->execute(); + $this->assertResults([]); + $this->queryResults = $this->factory->get('config_query_test') + ->notExists('array') + ->execute(); + $this->assertResults([]); } /** @@ -599,7 +626,8 @@ class ConfigEntityQueryTest extends KernelTestBase { $key_value = $this->container->get('keyvalue')->get(QueryFactory::CONFIG_LOOKUP_PREFIX . 'config_test'); $test_entities = []; - $entity = entity_create('config_test', [ + $storage = \Drupal::entityTypeManager()->getStorage('config_test'); + $entity = $storage->create([ 'label' => $this->randomMachineName(), 'id' => '1', 'style' => 'test', @@ -608,11 +636,10 @@ class ConfigEntityQueryTest extends KernelTestBase { $entity->enforceIsNew(); $entity->save(); - $expected[] = $entity->getConfigDependencyName(); $this->assertEqual($expected, $key_value->get('style:test')); - $entity = entity_create('config_test', [ + $entity = $storage->create([ 'label' => $this->randomMachineName(), 'id' => '2', 'style' => 'test', @@ -623,7 +650,7 @@ class ConfigEntityQueryTest extends KernelTestBase { $expected[] = $entity->getConfigDependencyName(); $this->assertEqual($expected, $key_value->get('style:test')); - $entity = entity_create('config_test', [ + $entity = $storage->create([ 'label' => $this->randomMachineName(), 'id' => '3', 'style' => 'blah',