function UpdateSemverCoreTest::testModulePageSecurityUpdate

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

File

core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php, line 394

Class

UpdateSemverCoreTest
Tests the semantic version handling in the Update Manager.

Namespace

Drupal\Tests\update\Functional

Code

public function testModulePageSecurityUpdate() {
  $this->drupalLogin($this->drupalCreateUser([
    'administer site configuration',
    'administer modules',
    'administer themes',
    'view update notifications',
  ]));
  $this->setProjectInstalledVersion('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', [
    'drupal' => 'sec.0.2',
  ])
    ->save();
  $this->drupalGet('admin/reports/updates');
  $this->clickLink('Check manually');
  $this->checkForMetaRefresh();
  $this->assertSession()
    ->pageTextContains('Checked available update data for one project.');
  $this->drupalGet('admin/modules');
  $this->assertSession()
    ->pageTextNotContains('There are updates available for your version of Drupal.');
  $this->assertSession()
    ->pageTextContains('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->assertSession()
    ->pageTextNotContains('There are updates available for your version of Drupal.');
  $this->assertSession()
    ->pageTextContains('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');
  $this->assertSession()
    ->pageTextContainsOnce('There is a security update available for your version of Drupal.');
  $this->drupalGet('admin/reports/updates');
  $this->assertSession()
    ->pageTextNotContains('There is a security update available for your version of Drupal.');
  $this->drupalGet('admin/reports/updates/settings');
  $this->assertSession()
    ->pageTextNotContains('There is a security update available for your version of Drupal.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.