You are here

function UpdateContribTest::testUpdateBaseThemeSecurityUpdate 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::testUpdateBaseThemeSecurityUpdate()

Tests that subthemes are notified about security updates for base themes.

File

core/modules/update/src/Tests/UpdateContribTest.php, line 192
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 testUpdateBaseThemeSecurityUpdate() {

  // @todo https://www.drupal.org/node/2338175 base themes have to be
  //  installed.
  // Only install the subtheme, not the base theme.
  \Drupal::service('theme_handler')
    ->install(array(
    'update_test_subtheme',
  ));

  // Define the initial state for core and the subtheme.
  $system_info = array(
    // We want core to be version 8.0.0.
    '#all' => array(
      'version' => '8.0.0',
    ),
    // Show the update_test_basetheme
    'update_test_basetheme' => array(
      'project' => 'update_test_basetheme',
      'version' => '8.x-1.0',
      'hidden' => FALSE,
    ),
    // Show the update_test_subtheme
    'update_test_subtheme' => array(
      'project' => 'update_test_subtheme',
      'version' => '8.x-1.0',
      'hidden' => FALSE,
    ),
  );
  $this
    ->config('update_test.settings')
    ->set('system_info', $system_info)
    ->save();
  $xml_mapping = array(
    'drupal' => '0.0',
    'update_test_subtheme' => '1_0',
    'update_test_basetheme' => '1_1-sec',
  );
  $this
    ->refreshUpdateStatus($xml_mapping);
  $this
    ->assertText(t('Security update required!'));
  $this
    ->assertRaw(\Drupal::l(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme')), 'Link to the Update test base theme project appears.');
}