You are here

function UpdateScriptTest::testNoUpdateFunctionality in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Update/UpdateScriptTest.php \Drupal\system\Tests\Update\UpdateScriptTest::testNoUpdateFunctionality()

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

File

core/modules/system/src/Tests/Update/UpdateScriptTest.php, line 149
Contains \Drupal\system\Tests\Update\UpdateScriptTest.

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\system\Tests\Update

Code

function testNoUpdateFunctionality() {

  // Click through update.php with 'administer software updates' permission.
  $this
    ->drupalLogin($this->updateUser);
  $this
    ->drupalGet($this->updateUrl, array(
    'external' => TRUE,
  ));
  $this
    ->clickLink(t('Continue'));
  $this
    ->assertText(t('No pending updates.'));
  $this
    ->assertNoLink('Administration pages');
  $this
    ->assertNoLinkByHrefInMainRegion('update.php', 0);
  $this
    ->clickLink('Front page');
  $this
    ->assertResponse(200);

  // Click through update.php with 'access administration pages' permission.
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer software updates',
    'access administration pages',
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet($this->updateUrl, array(
    'external' => TRUE,
  ));
  $this
    ->clickLink(t('Continue'));
  $this
    ->assertText(t('No pending updates.'));
  $this
    ->assertLink('Administration pages');
  $this
    ->assertNoLinkByHrefInMainRegion('update.php', 1);
  $this
    ->clickLink('Administration pages');
  $this
    ->assertResponse(200);
}