function ModuleRequiredByThemesUninstallValidatorTest::testValidateOneThemeDependency

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php \Drupal\Tests\Core\Extension\ModuleRequiredByThemesUninstallValidatorTest::testValidateOneThemeDependency()
  2. 10 core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php \Drupal\Tests\Core\Extension\ModuleRequiredByThemesUninstallValidatorTest::testValidateOneThemeDependency()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php \Drupal\Tests\Core\Extension\ModuleRequiredByThemesUninstallValidatorTest::testValidateOneThemeDependency()

@covers ::validate

File

core/tests/Drupal/Tests/Core/Extension/ModuleRequiredByThemesUninstallValidatorTest.php, line 71

Class

ModuleRequiredByThemesUninstallValidatorTest
@coversDefaultClass \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testValidateOneThemeDependency() {
    $module = 'single_module';
    $module_name = 'Single Module';
    $theme = 'one_theme';
    $theme_name = 'One Theme';
    $this->themeExtensionList
        ->getAllInstalledInfo()
        ->willReturn([
        'stable9' => [
            'name' => 'Stable 9',
            'dependencies' => [],
        ],
        'claro' => [
            'name' => 'Claro',
            'dependencies' => [],
        ],
        $theme => [
            'name' => $theme_name,
            'dependencies' => [
                $module,
            ],
        ],
    ]);
    $this->moduleExtensionList
        ->get($module)
        ->willReturn((object) [
        'info' => [
            'name' => $module_name,
        ],
    ]);
    $expected = [
        "Required by the theme: {$theme_name}",
    ];
    $reasons = $this->moduleRequiredByThemeUninstallValidator
        ->validate($module);
    $this->assertEquals($expected, $reasons);
}

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