1 update.test UpdateCoreTestCase::testModulePageSecurityUpdate()

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

File

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

Class

UpdateCoreTestCase

Code

function testModulePageSecurityUpdate() {
  $this->setSystemInfo1_0();
  $config = config('update.settings');
  // Instead of using refreshUpdateStatus(), set these manually.
  $config->set('update_url', url('update-test', array('absolute' => TRUE)))->save();
  state_set('update_test_xml_map', array('backdrop' => '2-sec'));

  $this->backdropGet('admin/reports/updates');
  $this->clickLink(t('Check manually'));
  $this->assertText(t('Checked available update data for one project.'));
  $this->backdropGet('admin/modules');
  $this->assertNoText(t('There are updates available for your version of Backdrop.'));
  $this->assertText(t('There is a security update available for your version of Backdrop.'));

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

  // Make sure duplicate messages don't appear on Update status pages.
  $this->backdropGet('admin/reports/status');
  // We're expecting "There is a security update..." inside the status report
  // itself, but the backdrop_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 Backdrop.'));

  $this->backdropGet('admin/reports/updates');
  $this->assertNoText(t('There is a security update available for your version of Backdrop.'));

  $this->backdropGet('admin/reports/updates/settings');
  $this->assertNoText(t('There is a security update available for your version of Backdrop.'));
}