You are here

function UpdateCoreTest::testModulePageSecurityUpdate in Zircon Profile 8

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

Checks the messages at admin/modules when a security update is missing.

File

core/modules/update/src/Tests/UpdateCoreTest.php, line 257
Contains \Drupal\update\Tests\UpdateCoreTest.

Class

UpdateCoreTest
Tests the Update Manager module through a series of functional tests using mock XML data.

Namespace

Drupal\update\Tests

Code

function testModulePageSecurityUpdate() {
  $this
    ->setSystemInfo('8.0.0');

  // Instead of using refreshUpdateStatus(), set these manually.
  $this
    ->config('update.settings')
    ->set('fetch.url', Url::fromRoute('update_test.update_test')
    ->setAbsolute()
    ->toString())
    ->save();
  $this
    ->config('update_test.settings')
    ->set('xml_map', array(
    'drupal' => '0.2-sec',
  ))
    ->save();
  $this
    ->drupalGet('admin/reports/updates');
  $this
    ->clickLink(t('Check manually'));
  $this
    ->assertText(t('Checked available update data for one project.'));
  $this
    ->drupalGet('admin/modules');
  $this
    ->assertNoText(t('There are updates available for your version of Drupal.'));
  $this
    ->assertText(t('There is a security update available for your version of Drupal.'));

  // Make sure admin/appearance warns you you're missing a security update.
  $this
    ->drupalGet('admin/appearance');
  $this
    ->assertNoText(t('There are updates available for your version of Drupal.'));
  $this
    ->assertText(t('There is a security update available for your version of Drupal.'));

  // Make sure duplicate messages don't appear on Update status pages.
  $this
    ->drupalGet('admin/reports/status');

  // We're expecting "There is a security update..." inside the status report
  // itself, but the drupal_set_message() appears as an li so we can prefix
  // with that and search for the raw HTML.
  $this
    ->assertNoRaw('<li>' . t('There is a security update available for your version of Drupal.'));
  $this
    ->drupalGet('admin/reports/updates');
  $this
    ->assertNoText(t('There is a security update available for your version of Drupal.'));
  $this
    ->drupalGet('admin/reports/updates/settings');
  $this
    ->assertNoText(t('There is a security update available for your version of Drupal.'));
}