function UpdateContribTest::testUpdateHiddenBaseTheme

Same name in other branches
  1. 8.9.x core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testUpdateHiddenBaseTheme()
  2. 10 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testUpdateHiddenBaseTheme()
  3. 11.x core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testUpdateHiddenBaseTheme()

Tests updates with a hidden base theme.

File

core/modules/update/tests/src/Functional/UpdateContribTest.php, line 422

Class

UpdateContribTest
Tests how the Update Manager handles contributed modules and themes.

Namespace

Drupal\Tests\update\Functional

Code

public function testUpdateHiddenBaseTheme() {
    \Drupal::moduleHandler()->loadInclude('update', 'inc', 'update.compare');
    // Install the subtheme.
    \Drupal::service('theme_installer')->install([
        'update_test_subtheme',
    ]);
    // Add a project and initial state for base theme and subtheme.
    $system_info = [
        // Hide the update_test_basetheme.
'update_test_basetheme' => [
            'project' => 'update_test_basetheme',
            'hidden' => TRUE,
        ],
        // Show the update_test_subtheme.
'update_test_subtheme' => [
            'project' => 'update_test_subtheme',
            'hidden' => FALSE,
        ],
    ];
    $this->config('update_test.settings')
        ->set('system_info', $system_info)
        ->save();
    $projects = \Drupal::service('update.manager')->getProjects();
    $theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
    $project_info = new ProjectInfo();
    $project_info->processInfoList($projects, $theme_data, 'theme', TRUE);
    $this->assertNotEmpty($projects['update_test_basetheme'], 'Valid base theme (update_test_basetheme) was found.');
}

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