function UpdateMiscTest::testModulePageSecurityUpdate

Same name and namespace in other branches
  1. 11.x core/modules/update/tests/src/Functional/UpdateMiscTest.php \Drupal\Tests\update\Functional\UpdateMiscTest::testModulePageSecurityUpdate()

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

File

core/modules/update/tests/src/Functional/UpdateMiscTest.php, line 191

Class

UpdateMiscTest
Tests general functionality of the Update module.

Namespace

Drupal\Tests\update\Functional

Code

public function testModulePageSecurityUpdate() : void {
  $this->drupalLogin($this->drupalCreateUser([
    'administer site configuration',
    'administer modules',
    'administer themes',
    'view update notifications',
  ]));
  // Instead of using refreshUpdateStatus(), set these manually.
  $this->config('update.settings')
    ->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()
    ->toString())
    ->save();
  $this->mockReleaseHistory([
    'drupal' => 'sec.8.0.2',
  ]);
  $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.