summaryrefslogtreecommitdiff
path: root/modules/system/system.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system/system.test')
-rw-r--r--modules/system/system.test45
1 files changed, 44 insertions, 1 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index a75153f6a..a00f51e26 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -2086,7 +2086,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp();
+ parent::setUp('update_script_test');
$this->update_url = $GLOBALS['base_url'] . '/update.php';
$this->update_user = $this->drupalCreateUser(array('administer software updates'));
}
@@ -2123,6 +2123,49 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
}
/**
+ * Tests that requirements warnings and errors are correctly displayed.
+ */
+ function testRequirements() {
+ $this->drupalLogin($this->update_user);
+
+ // If there are no requirements warnings or errors, we expect to be able to
+ // go through the update process uninterrupted.
+ $this->drupalGet($this->update_url, array('external' => TRUE));
+ $this->drupalPost(NULL, array(), t('Continue'));
+ $this->assertText(t('No pending updates.'), t('End of update process was reached.'));
+
+ // If there is a requirements warning, we expect it to be initially
+ // displayed, but clicking the link to proceed should allow us to go
+ // through the rest of the update process uninterrupted. (First run this
+ // test with pending updates to make sure they can be run successfully;
+ // then try again without pending updates to make sure that works too.)
+ variable_set('update_script_test_requirement_type', REQUIREMENT_WARNING);
+ drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);
+ $this->drupalGet($this->update_url, array('external' => TRUE));
+ $this->assertText('This is a requirements warning provided by the update_script_test module.');
+ $this->clickLink('try again');
+ $this->assertNoText('This is a requirements warning provided by the update_script_test module.');
+ $this->drupalPost(NULL, array(), t('Continue'));
+ $this->drupalPost(NULL, array(), t('Apply pending updates'));
+ $this->assertText(t('The update_script_test_update_7000() update was executed successfully.'), t('End of update process was reached.'));
+ $this->drupalGet($this->update_url, array('external' => TRUE));
+ $this->assertText('This is a requirements warning provided by the update_script_test module.');
+ $this->clickLink('try again');
+ $this->assertNoText('This is a requirements warning provided by the update_script_test module.');
+ $this->drupalPost(NULL, array(), t('Continue'));
+ $this->assertText(t('No pending updates.'), t('End of update process was reached.'));
+
+ // If there is a requirements error, it should be displayed even after
+ // clicking the link to proceed (since the problem that triggered the error
+ // has not been fixed).
+ variable_set('update_script_test_requirement_type', REQUIREMENT_ERROR);
+ $this->drupalGet($this->update_url, array('external' => TRUE));
+ $this->assertText('This is a requirements error provided by the update_script_test module.');
+ $this->clickLink('try again');
+ $this->assertText('This is a requirements error provided by the update_script_test module.');
+ }
+
+ /**
* Tests the effect of using the update script on the theme system.
*/
function testThemeSystem() {