function ThemeUiTest::providerTestThemeInstallWithModuleDependencies

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php \Drupal\Tests\system\Functional\Theme\ThemeUiTest::providerTestThemeInstallWithModuleDependencies()
  2. 10 core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php \Drupal\Tests\system\Functional\Theme\ThemeUiTest::providerTestThemeInstallWithModuleDependencies()
  3. 11.x core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php \Drupal\Tests\system\Functional\Theme\ThemeUiTest::providerTestThemeInstallWithModuleDependencies()

Data provider for testThemeInstallWithModuleDependencies().

Return value

array An array of arrays. Details on the specific elements can be found in the function body.

File

core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php, line 212

Class

ThemeUiTest
Tests the theme UI.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function providerTestThemeInstallWithModuleDependencies() {
    // Data provider values with the following keys:
    // -'theme_name': The name of the theme being tested.
    // -'first_modules': Array of module machine names to enable first.
    // -'second_modules': Array of module machine names to enable second.
    // -'required_by_messages': Array for checking the messages explaining why a
    // module can't be uninstalled. The array key is the selector where the
    // message should appear, the array value is the expected message.
    // -'base_theme_to_uninstall': The name of a base theme that needs to be
    // uninstalled before modules it depends on can be uninstalled.
    // -'base_theme_module_names': Array of machine names of the modules
    // required by base_theme_to_uninstall.
    return [
        'test theme with a module dependency and base theme with a different module dependency' => [
            'theme_name' => 'Test Theme with a Module Dependency and Base Theme with a Different Module Dependency',
            'first_modules' => [
                'test_module_required_by_theme',
                'test_another_module_required_by_theme',
            ],
            'second_modules' => [
                'help',
            ],
            'required_by_messages' => [
                '[data-drupal-selector="edit-test-another-module-required-by-theme"] .item-list' => 'Required by the theme: Test Theme Depending on Modules',
                '[data-drupal-selector="edit-test-module-required-by-theme"] .item-list' => 'Required by the theme: Test Theme Depending on Modules',
                '[data-drupal-selector="edit-help"] .item-list' => 'Required by the theme: Test Theme with a Module Dependency and Base Theme with a Different Module Dependency',
            ],
            'base_theme_to_uninstall' => 'Test Theme Depending on Modules',
            'base_theme_module_names' => [
                'test_module_required_by_theme',
                'test_another_module_required_by_theme',
            ],
        ],
        'Test Theme Depending on Modules' => [
            'theme_name' => 'Test Theme Depending on Modules',
            'first_modules' => [
                'test_module_required_by_theme',
            ],
            'second_modules' => [
                'test_another_module_required_by_theme',
            ],
            'required_by_messages' => [
                '[data-drupal-selector="edit-test-another-module-required-by-theme"] .item-list' => 'Required by the theme: Test Theme Depending on Modules',
                '[data-drupal-selector="edit-test-module-required-by-theme"] .item-list' => 'Required by the theme: Test Theme Depending on Modules',
            ],
            'base_theme_to_uninstall' => '',
            'base_theme_module_names' => [],
        ],
        'test theme with a base theme depending on modules' => [
            'theme_name' => 'Test Theme with a Base Theme Depending on Modules',
            'first_modules' => [
                'test_module_required_by_theme',
            ],
            'second_modules' => [
                'test_another_module_required_by_theme',
            ],
            'required_by_messages' => [
                '[data-drupal-selector="edit-test-another-module-required-by-theme"] .item-list' => 'Required by the theme: Test Theme Depending on Modules',
                '[data-drupal-selector="edit-test-module-required-by-theme"] .item-list' => 'Required by the theme: Test Theme Depending on Modules',
            ],
            'base_theme_to_uninstall' => 'Test Theme Depending on Modules',
            'base_theme_module_names' => [
                'test_module_required_by_theme',
                'test_another_module_required_by_theme',
            ],
        ],
    ];
}

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