1 system.test UpdateScriptFunctionalTest::testSuccessfulUpdateFunctionality()

Tests update.php after performing a successful update.

File

core/modules/system/tests/system.test, line 2277
Tests for system.module.

Class

UpdateScriptFunctionalTest
Tests for the update system functionality.

Code

function testSuccessfulUpdateFunctionality() {
  backdrop_set_installed_schema_version('update_script_test', backdrop_get_installed_schema_version('update_script_test') - 1);
  // Click through update.php with 'administer software updates' permission.
  $this->backdropLogin($this->update_user);
  $this->backdropPost($this->update_url, array(), t('Continue'), array('external' => TRUE));
  $this->backdropPost(NULL, array(), t('Apply pending updates'));
  $this->assertText('Updates were attempted.');
  $this->assertLink('site');
  $this->assertNoLink('Administration pages');
  $this->assertNoLink('logged');
  $this->clickLink('Home page');
  $this->assertResponse(200);

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