function EntityStorageBaseTest::providerLoadMultiple

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php \Drupal\Tests\Core\Entity\EntityStorageBaseTest::providerLoadMultiple()
  2. 11.x core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php \Drupal\Tests\Core\Entity\EntityStorageBaseTest::providerLoadMultiple()

Data provider for testLoadMultiple.

File

core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php, line 73

Class

EntityStorageBaseTest
@coversDefaultClass \Drupal\Core\Entity\EntityStorageBase @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public static function providerLoadMultiple() : \Generator {
    // Data set for NULL ID parameter.
    (yield 'null-id-parameter' => [
        range(1, 10),
        range(1, 10),
        NULL,
    ]);
    // Data set for no results.
    (yield 'no-results' => [
        [],
        [],
        [
            '11',
        ],
    ]);
    // Data set for 0 results for multiple IDs.
    (yield 'no-results-multiple-ids' => [
        [],
        [],
        [
            '11',
            '12',
            '13',
        ],
    ]);
    // Data set for 1 result for 1 ID.
    (yield '1-result-for-1-id' => [
        [
            '1' => '1',
        ],
        [
            '1' => '1',
        ],
        [
            '1',
        ],
    ]);
    // Data set for results for all IDs.
    $ids = [
        '1',
        '2',
        '3',
    ];
    (yield 'results-for-all-ids' => [
        $ids,
        $ids,
        $ids,
    ]);
    // Data set for partial results for multiple IDs.
    (yield 'partial-results-for-multiple-ids' => [
        $ids,
        $ids,
        array_merge($ids, [
            '11',
            '12',
        ]),
    ]);
}

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