function ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections()
  2. 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections()
  3. 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections()

Data provider for testCalculateDependenciesWithPluginCollections.

Return value

array

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php, line 290

Class

ConfigEntityBaseUnitTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function providerCalculateDependenciesWithPluginCollections() {
    // Start with 'a' so that order of the dependency array is fixed.
    $instance_dependency_1 = 'a' . $this->randomMachineName(10);
    $instance_dependency_2 = 'a' . $this->randomMachineName(11);
    return [
        // Tests that the plugin provider is a module dependency.
[
            [
                'provider' => 'test',
            ],
            [
                'module' => [
                    'test',
                ],
            ],
        ],
        // Tests that the plugin provider is a theme dependency.
[
            [
                'provider' => 'test_theme',
            ],
            [
                'theme' => [
                    'test_theme',
                ],
            ],
        ],
        // Tests that a plugin that is provided by the same module as the config
        // entity is not added to the dependencies array.
[
            [
                'provider' => $this->provider,
            ],
            [],
        ],
        // Tests that a config entity that has a plugin which provides config
        // dependencies in its definition has them.
[
            [
                'provider' => 'test',
                'config_dependencies' => [
                    'config' => [
                        $instance_dependency_1,
                    ],
                    'module' => [
                        $instance_dependency_2,
                    ],
                ],
            ],
            [
                'config' => [
                    $instance_dependency_1,
                ],
                'module' => [
                    $instance_dependency_2,
                    'test',
                ],
            ],
        ],
    ];
}

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