function UpdateContribTest::testUpdateHiddenBaseTheme

Same name and namespace in other branches
  1. 9 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 413

Class

UpdateContribTest
Tests how the Update Manager module handles contributed modules and themes in a series of functional tests using mock XML data.

Namespace

Drupal\Tests\update\Functional

Code

public function testUpdateHiddenBaseTheme() {
    module_load_include('compare.inc', 'update');
    // 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->assertTrue(!empty($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.