? sites/default/modules
? sites/default/settings.php
Index: modules/simpletest/tests/database_test.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v
retrieving revision 1.10
diff -u -p -r1.10 database_test.test
--- modules/simpletest/tests/database_test.test	16 Oct 2008 14:58:48 -0000	1.10
+++ modules/simpletest/tests/database_test.test	18 Oct 2008 02:58:33 -0000
@@ -1804,3 +1804,71 @@ class DatabaseLoggingTestCase extends Da
     }
   }
 }
+
+/**
+ * Range query tests.
+ */
+class DatabaseRangeQueryTestCase extends DatabaseTestCase {
+
+  function getInfo() {
+    return array(
+      'name' => t('Range query test'),
+      'description' => t('Test the Range query builder.'),
+      'group' => t('Database'),
+    );
+  }
+
+  /**
+   * Test that Range query is functioning with default values.
+   */
+  function testRangeQueryDefault() {
+    $count = 0;
+    $results = db_query_range("SELECT * FROM {test}", array());
+    $rows = 0;
+    foreach ($results as $result) {
+      $rows++;
+    }
+    $this->assertIdentical($rows, $count, t('Range query is functioning with default values.'));
+  }
+
+  /**
+   * Test that Range query is functioning with range limit.
+   */
+  function testRangeQueryRangeLimit() {
+    $count = 2;
+    $results = db_query_range("SELECT * FROM {test}", array(), 0, $count);
+    $rows = 0;
+    foreach ($results as $result) {
+      $rows++;
+    }
+    $this->assertIdentical($rows, $count, t('Range query is functioning with range limit.'));
+  }
+
+  /**
+   * Test that Range query is functioning with named placeholders.
+   */
+  function testRangeQueryNamedPlaceholders() {
+    // Query should return 3 successful results, but we just fetch 2 of it.
+    $count = 2;
+    $results = db_query_range("SELECT * FROM {test} WHERE age >= :age", array(':age' => '26'), 0, $count);
+    $rows = 0;
+    foreach ($results as $result) {
+      $rows++;
+    }
+    $this->assertIdentical($rows, $count, t('Range query is functioning with named placeholders.'));
+  }
+
+  /**
+   * Test that Range query is functioning with unnamed placeholders.
+   */
+  function testRangeQueryUnnamedPlaceholders() {
+    // Query should return 3 successful results, but we just fetch 2 of it.
+    $count = 2;
+    $results = db_query_range("SELECT * FROM {test} WHERE age >= ?", array('26'), 0, $count);
+    $rows = 0;
+    foreach ($results as $result) {
+      $rows++;
+    }
+    $this->assertIdentical($rows, $count, t('Range query is functioning with unnamed placeholders.'));
+  }
+}
