You are here

function UpdateContribTest::testUpdateHiddenBaseTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/update/src/Tests/UpdateContribTest.php \Drupal\update\Tests\UpdateContribTest::testUpdateHiddenBaseTheme()

Tests updates with a hidden base theme.

File

core/modules/update/src/Tests/UpdateContribTest.php, line 299
Contains \Drupal\update\Tests\UpdateContribTest.

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\update\Tests

Code

function testUpdateHiddenBaseTheme() {
  module_load_include('compare.inc', 'update');

  // Install the subtheme.
  \Drupal::service('theme_handler')
    ->install(array(
    'update_test_subtheme',
  ));

  // Add a project and initial state for base theme and subtheme.
  $system_info = array(
    // Hide the update_test_basetheme.
    'update_test_basetheme' => array(
      'project' => 'update_test_basetheme',
      'hidden' => TRUE,
    ),
    // Show the update_test_subtheme.
    'update_test_subtheme' => array(
      '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.');
}