1 update.test UpdateTestContribCase::testUpdateAdminThemeSecurityUpdate()

Tests that the admin theme is always notified about security updates.

File

core/modules/update/tests/update.test, line 441
This file contains tests for the Update Manager module.

Class

UpdateTestContribCase

Code

function testUpdateAdminThemeSecurityUpdate() {
  // Disable the admin theme.
  db_update('system')
    ->fields(array('status' => 0))
    ->condition('type', 'theme')
    ->condition('name', 'update_test_%', 'LIKE')
    ->execute();

  config_set('system.core', 'admin_theme', 'update_test_admintheme');

  // Define the initial state for core and the themes.
  $system_info = array(
    '#all' => array(
      'version' => '1.0',
    ),
    'update_test_admintheme' => array(
      'project' => 'update_test_admintheme',
      'version' => '1.x-1.0',
      'hidden' => FALSE,
    ),
    'update_test_basetheme' => array(
      'project' => 'update_test_basetheme',
      'version' => '1.x-1.1',
      'hidden' => FALSE,
    ),
    'update_test_subtheme' => array(
      'project' => 'update_test_subtheme',
      'version' => '1.x-1.0',
      'hidden' => FALSE,
    ),
  );
  state_set('update_test_system_info', $system_info);
  config_set('update.settings', 'update_check_disabled', FALSE);
  $xml_mapping = array(
    // This is enough because we don't check the update status of the admin
    // theme. We want to check that the admin theme is included in the list.
    'backdrop' => '0',
  );
  $this->refreshUpdateStatus($xml_mapping);
  // The admin theme is displayed even if it's disabled.
  $this->assertText('update_test_admintheme', "The admin theme is checked for update even if it's disabled");
  // The other disabled themes are not displayed.
  $this->assertNoText('update_test_basetheme', 'Disabled theme is not checked for update in the list.');
  $this->assertNoText('update_test_subtheme', 'Disabled theme is not checked for update in the list.');
}