Commit 2ccb0f6c authored by webchick's avatar webchick
Browse files

Issue #1901546 by Berdir, chx: Fixed Random failures in...

Issue #1901546 by Berdir, chx: Fixed Random failures in Drupal\system\Tests\Entity\ConfigEntityQueryTest.
parent c4c71f4c
......@@ -114,13 +114,18 @@ protected function matchArray(array $condition, array $data, array $needs_matchi
$candidates = array($parent);
}
foreach ($candidates as $key) {
if ($needs_matching && is_array($data[$key])) {
if ($needs_matching) {
if (is_array($data[$key])) {
$new_parents = $parents;
$new_parents[] = $key;
if ($this->matchArray($condition, $data[$key], $needs_matching, $new_parents)) {
return TRUE;
}
}
}
// Only try to match a scalar if there are no remaining keys in
// $needs_matching as this indicates that we are looking for a specific
// subkey and a scalar can never match that.
elseif ($this->match($condition, $data[$key])) {
return TRUE;
}
......
......@@ -425,6 +425,13 @@ protected function testDotted() {
->condition('array.level1.level2', 3)
->execute();
$this->assertResults(array('5'));
// Make sure that values on the wildcard level do not match if if there are
// sub-keys defined. This must not find anything even if entity 2 has a
// top-level key number with value 41.
$this->queryResults = $this->factory->get('config_query_test')
->condition('*.level1.level2', 41)
->execute();
$this->assertResults(array());
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment