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. 8.9.x 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 404

Class

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

Namespace

Drupal\Tests\update\Functional

Code

public function testUpdateHiddenBaseTheme() : void {
  \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.
  $this->mockInstalledExtensionsInfo([
    // 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,
    ],
  ]);
  $projects = \Drupal::service('update.manager')->getProjects();
  $theme_data = \Drupal::service('extension.list.theme')->reset()
    ->getList();
  $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.