function UpdateScriptTest::testNoUpdateFunctionality

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testNoUpdateFunctionality()
  2. 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testNoUpdateFunctionality()
  3. 11.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testNoUpdateFunctionality()

Tests update.php when there are no updates to apply.

File

core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php, line 502

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testNoUpdateFunctionality() {
    // Click through update.php with 'administer software updates' permission.
    $this->drupalLogin($this->updateUser);
    $this->drupalGet($this->updateUrl, [
        'external' => TRUE,
    ]);
    $this->updateRequirementsProblem();
    $this->clickLink('Continue');
    $this->assertSession()
        ->pageTextContains('No pending updates.');
    $this->assertSession()
        ->linkNotExists('Administration pages');
    $this->assertSession()
        ->elementNotExists('xpath', '//main//a[contains(@href, "update.php")]');
    $this->clickLink('Front page');
    $this->assertSession()
        ->statusCodeEquals(200);
    // Click through update.php with 'access administration pages' permission.
    $admin_user = $this->drupalCreateUser([
        'administer software updates',
        'access administration pages',
    ]);
    $this->drupalLogin($admin_user);
    $this->drupalGet($this->updateUrl, [
        'external' => TRUE,
    ]);
    $this->updateRequirementsProblem();
    $this->clickLink('Continue');
    $this->assertSession()
        ->pageTextContains('No pending updates.');
    $this->assertSession()
        ->linkExists('Administration pages');
    $this->assertSession()
        ->elementNotExists('xpath', '//main//a[contains(@href, "update.php")]');
    $this->clickLink('Administration pages');
    $this->assertSession()
        ->statusCodeEquals(200);
}

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