function ConfigEntityValidationTestBase::providerConfigDependenciesValidation

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::providerConfigDependenciesValidation()

Data provider for ::testConfigDependenciesValidation().

Return value

array[] The test cases.

File

core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php, line 208

Class

ConfigEntityValidationTestBase
Base class for testing validation of config entities.

Namespace

Drupal\KernelTests\Core\Config

Code

public static function providerConfigDependenciesValidation() : array {
    return [
        'valid dependency types' => [
            [
                'config' => [
                    'system.site',
                ],
                'content' => [
                    'node:some-random-uuid',
                ],
                'module' => [
                    'system',
                ],
                'theme' => [
                    'stark',
                ],
            ],
            [],
        ],
        'unknown dependency type' => [
            [
                'fun_stuff' => [
                    'star-trek.deep-space-nine',
                ],
            ],
            [
                'dependencies.fun_stuff' => "'fun_stuff' is not a supported key.",
            ],
        ],
        'empty string in config dependencies' => [
            [
                'config' => [
                    '',
                ],
            ],
            [
                'dependencies.config.0' => [
                    'This value should not be blank.',
                    "The '' config does not exist.",
                ],
            ],
        ],
        'non-existent config dependency' => [
            [
                'config' => [
                    'fake_settings',
                ],
            ],
            [
                'dependencies.config.0' => "The 'fake_settings' config does not exist.",
            ],
        ],
        'empty string in module dependencies' => [
            [
                'module' => [
                    '',
                ],
            ],
            [
                'dependencies.module.0' => [
                    'This value should not be blank.',
                    "Module '' is not installed.",
                ],
            ],
        ],
        'invalid module dependency' => [
            [
                'module' => [
                    'invalid-module-name',
                ],
            ],
            [
                'dependencies.module.0' => [
                    'This value is not valid.',
                    "Module 'invalid-module-name' is not installed.",
                ],
            ],
        ],
        'non-installed module dependency' => [
            [
                'module' => [
                    'bad_judgment',
                ],
            ],
            [
                'dependencies.module.0' => "Module 'bad_judgment' is not installed.",
            ],
        ],
        'empty string in theme dependencies' => [
            [
                'theme' => [
                    '',
                ],
            ],
            [
                'dependencies.theme.0' => [
                    'This value should not be blank.',
                    "Theme '' is not installed.",
                ],
            ],
        ],
        'invalid theme dependency' => [
            [
                'theme' => [
                    'invalid-theme-name',
                ],
            ],
            [
                'dependencies.theme.0' => [
                    'This value is not valid.',
                    "Theme 'invalid-theme-name' is not installed.",
                ],
            ],
        ],
        'non-installed theme dependency' => [
            [
                'theme' => [
                    'ugly_theme',
                ],
            ],
            [
                'dependencies.theme.0' => "Theme 'ugly_theme' is not installed.",
            ],
        ],
    ];
}

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