function QueryFactoryTest::providerTestGetKeys

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php \Drupal\Tests\Core\Config\Entity\Query\QueryFactoryTest::providerTestGetKeys()
  2. 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php \Drupal\Tests\Core\Config\Entity\Query\QueryFactoryTest::providerTestGetKeys()
  3. 11.x core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php \Drupal\Tests\Core\Config\Entity\Query\QueryFactoryTest::providerTestGetKeys()

File

core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php, line 40

Class

QueryFactoryTest
@coversDefaultClass \Drupal\Core\Config\Entity\Query\QueryFactory @group Config

Namespace

Drupal\Tests\Core\Config\Entity\Query

Code

public static function providerTestGetKeys() : \Generator {
    (yield [
        [
            'uuid:abc',
        ],
        'uuid',
        [
            [
                'uuid',
                'abc',
            ],
        ],
    ]);
    // Tests a lookup being set to a top level key when sub-keys exist.
    (yield [
        [],
        'uuid',
        [
            [
                'uuid.blah',
                'abc',
            ],
        ],
    ]);
    // Tests a non existent key.
    (yield [
        [],
        'uuid',
        [],
    ]);
    // Tests a non existent sub key.
    (yield [
        [],
        'uuid.blah',
        [
            [
                'uuid',
                'abc',
            ],
        ],
    ]);
    // Tests an existent sub key.
    (yield [
        [
            'uuid.blah:abc',
        ],
        'uuid.blah',
        [
            [
                'uuid.blah',
                'abc',
            ],
        ],
    ]);
    // One wildcard.
    (yield [
        [
            'test.*.value:a',
            'test.*.value:b',
        ],
        'test.*.value',
        [
            [
                'test.a.value',
                'a',
            ],
            [
                'test.b.value',
                'b',
            ],
        ],
    ]);
    // Three wildcards.
    (yield [
        [
            'test.*.sub2.*.sub4.*.value:aaa',
            'test.*.sub2.*.sub4.*.value:aab',
            'test.*.sub2.*.sub4.*.value:bab',
        ],
        'test.*.sub2.*.sub4.*.value',
        [
            [
                'test.a.sub2.a.sub4.a.value',
                'aaa',
            ],
            [
                'test.a.sub2.a.sub4.b.value',
                'aab',
            ],
            [
                'test.b.sub2.a.sub4.b.value',
                'bab',
            ],
        ],
    ]);
    // Three wildcards in a row.
    (yield [
        [
            'test.*.*.*.value:abc',
            'test.*.*.*.value:abd',
        ],
        'test.*.*.*.value',
        [
            [
                'test.a.b.c.value',
                'abc',
            ],
            [
                'test.a.b.d.value',
                'abd',
            ],
        ],
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.