summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/database_test.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests/database_test.test')
-rw-r--r--modules/simpletest/tests/database_test.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index a59e321aa..b0b299215 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -1995,6 +1995,34 @@ class DatabaseRegressionTestCase extends DatabaseTestCase {
$this->assertTrue(db_table_exists('node'), t('Returns true for existent table.'));
$this->assertFalse(db_table_exists('nosuchtable'), t('Returns false for nonexistent table.'));
}
+
+ /**
+ * Test that string comparison is case-sensitive.
+ */
+ function testCaseSensitiviteCompare() {
+ $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name = :name", array(':name' => 'George'))->fetchField();
+ $this->assertEqual($num_matches, 1, t('Correct number of records found with proper case.'));
+ $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name = :name", array(':name' => 'GEORGE'))->fetchField();
+ $this->assertEqual($num_matches, 0, t('Correct number of records found with wrong case.'));
+
+ $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name LIKE :name", array(':name' => 'Geo%'))->fetchField();
+ $this->assertEqual($num_matches, 1, t('Correct number of records found with proper case.'));
+ $num_matches = db_query("SELECT COUNT(*) FROM {test} WHERE name LIKE :name", array(':name' => 'GEO%'))->fetchField();
+ $this->assertEqual($num_matches, 0, t('Correct number of records found with wrong case.'));
+
+ $num_matches = db_select('test')
+ ->condition('name', 'Geo%', 'LIKE')
+ ->countQuery()
+ ->execute()
+ ->fetchField();
+ $this->assertEqual($num_matches, 1, t('Correct number of records found with proper case.'));
+ $num_matches = db_select('test')
+ ->condition('name', 'GEO%', 'LIKE')
+ ->countQuery()
+ ->execute()
+ ->fetchField();
+ $this->assertEqual($num_matches, 0, t('Correct number of records found with wrong case.'));
+ }
}
/**