summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-18 06:56:24 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-18 06:56:24 +0000
commit3dddaa3e6ff47b52df5836a49272952893208ddc (patch)
tree2f3f069774f2f2091a0a169c6210fc356e2d057a /modules/simpletest
parent1650fea5d949b576bcc779d6315250da0ba7ec82 (diff)
downloadbrdo-3dddaa3e6ff47b52df5836a49272952893208ddc.tar.gz
brdo-3dddaa3e6ff47b52df5836a49272952893208ddc.tar.bz2
#356074 by chx and Damien Tournoud: Provide a sequences API. Gets rid of stupid tables that only contain an incrementing ID, and fixes database import problems due to user ID 0.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/tests/actions.test6
-rw-r--r--modules/simpletest/tests/database_test.test27
2 files changed, 31 insertions, 2 deletions
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test
index 12a97cc5f..7cc06b558 100644
--- a/modules/simpletest/tests/actions.test
+++ b/modules/simpletest/tests/actions.test
@@ -37,11 +37,13 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
// Make another POST request to the action edit page.
$this->clickLink(t('configure'));
+ preg_match('|admin/config/system/actions/configure/(\d+)|', $this->getUrl(), $matches);
+ $aid = $matches[1];
$edit = array();
$new_action_label = $this->randomName();
$edit['actions_label'] = $new_action_label;
$edit['url'] = 'admin';
- $this->drupalPost('admin/config/system/actions/configure/1', $edit, t('Save'));
+ $this->drupalPost(NULL, $edit, t('Save'));
// Make sure that the action updated properly.
$this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully updated the complex action."));
@@ -51,7 +53,7 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
// Make sure that deletions work properly.
$this->clickLink(t('delete'));
$edit = array();
- $this->drupalPost('admin/config/system/actions/delete/1', $edit, t('Delete'));
+ $this->drupalPost("admin/config/system/actions/delete/$aid", $edit, t('Delete'));
// Make sure that the action was actually deleted.
$this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), t('Make sure that we get a delete confirmation message.'));
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index 8d400e68c..d64ee9ed0 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -2981,3 +2981,30 @@ class DatabaseExtraTypesTestCase extends DrupalWebTestCase {
}
+
+/**
+ * Check the sequences API.
+ */
+class DatabaseNextIdCase extends DrupalWebTestCase {
+ function getInfo() {
+ return array(
+ 'name' => t('Sequences API'),
+ 'description' => t('Test the secondary sequences API.'),
+ 'group' => t('Database'),
+ );
+ }
+
+ /**
+ * Test that the sequences API work.
+ */
+ function testDbNextId() {
+ $first = db_next_id();
+ $second = db_next_id();
+ // We can test for exact increase in here because we know there is no
+ // other process operating on these tables -- normally we could only
+ // expect $second > $first.
+ $this->assertEqual($first + 1, $second, t('The second call from a sequence provides a number increased by one.'));
+ $result = db_next_id(1000);
+ $this->assertEqual($result, 1001, t('Sequence provides a larger number than the existing ID.'));
+ }
+}