diff --git a/core/modules/system/src/Tests/Entity/EntityQueryTest.php b/core/modules/system/src/Tests/Entity/EntityQueryTest.php index 0872e78..d0add92 100644 --- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/src/Tests/Entity/EntityQueryTest.php @@ -447,8 +447,8 @@ public function testCount() { * Test queries with delta conditions. */ public function testDelta() { - $greetings = $this->greetings; $figures = $this->figures; + // Test numeric delta value in field condition. $this->queryResults = $this->factory->get('entity_test_mulrev') ->condition("$figures.0.color", 'red') ->sort('id') @@ -463,13 +463,22 @@ public function testDelta() { // Delta 1 is not red. $this->assertResult(); + // Test '?' wildcard $this->queryResults = $this->factory->get('entity_test_mulrev') - ->condition("$figures.?.color", 'red') + ->condition("$figures.?.color", array('blue', 'red')) ->condition("$figures.?", array(0, 1), 'IN') ->sort('id') ->execute(); - // As unit 0 at delta 0 was the red triangle bit 0 needs to be set. - $this->assertResult(1, 3, 5, 7, 9, 11, 13, 15); + // Figure delta 0 or 1 can be blue or red, this matches a lot of entities. + $this->assertResult(1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15); + + // Test '?' wildcard without other conditions. + $this->queryResults = $this->factory->get('entity_test_mulrev') + ->condition("$figures.?", 1) + ->sort('id') + ->execute(); + // Entity needs to have atleast two figures. + $this->assertResult(3, 7, 11, 15); } protected function assertResult() {