function UpdateMiscTest::testModulePageRegularUpdate

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

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

File

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

Class

UpdateMiscTest
Tests general functionality of the Update module.

Namespace

Drupal\Tests\update\Functional

Code

public function testModulePageRegularUpdate() : void {
    $this->drupalLogin($this->drupalCreateUser([
        'administer site configuration',
        'administer modules',
        '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->config('update_test.settings')
        ->set('xml_map', [
        'drupal' => '8.0.1',
    ])
        ->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()
        ->pageTextContains('There are updates available for your version of Drupal.');
    $this->assertSession()
        ->pageTextNotContains('There is a security update available for your version of Drupal.');
    // A user without the "view update notifications" permission shouldn't be
    // notified about available updates.
    $this->drupalLogin($this->drupalCreateUser([
        'administer site configuration',
        'administer modules',
    ]));
    $this->drupalGet('admin/modules');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->pageTextNotContains('There are updates available for your version of Drupal.');
}

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