You are here

public function ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections()
  2. 9 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 289
Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest.

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',
        ],
      ],
    ],
  ];
}