function UpdateScriptTest::testSuccessfulUpdateFunctionality

Tests update.php after performing a successful update.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php, line 162
Definition of Drupal\system\Tests\Update\UpdateScriptTest.

Class

UpdateScriptTest
Tests the update system functionality.

Namespace

Drupal\system\Tests\Update

Code

function testSuccessfulUpdateFunctionality() {
  drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);

  // Click through update.php with 'administer software updates' permission.
  $this
    ->drupalLogin($this->update_user);
  $this
    ->drupalPost($this->update_url, array(), t('Continue'), array(
    'external' => TRUE,
  ));
  $this
    ->drupalPost(NULL, array(), t('Apply pending updates'));
  $this
    ->assertText('Updates were attempted.');
  $this
    ->assertLink('site');
  $this
    ->assertNoLink('Administration pages');
  $this
    ->assertNoLink('logged');
  $this
    ->clickLink('Front page');
  $this
    ->assertResponse(200);
  drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);

  // Click through update.php with 'access administration pages' and
  // 'access site reports' permissions.
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer software updates',
    'access administration pages',
    'access site reports',
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalPost($this->update_url, array(), t('Continue'), array(
    'external' => TRUE,
  ));
  $this
    ->drupalPost(NULL, array(), t('Apply pending updates'));
  $this
    ->assertText('Updates were attempted.');
  $this
    ->assertLink('logged');
  $this
    ->clickLink('Administration pages');
  $this
    ->assertResponse(200);
}