diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-04-22 18:57:18 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-04-22 18:57:18 -0700 |
commit | a50f016991527c419595f81397f3ad67e12bea1c (patch) | |
tree | 38a375d18b77950fc9801617f7e14f772d61c172 /modules/simpletest/tests/database_test.test | |
parent | b716b2ccaf5ce89f4600311d6334b66acfa562b2 (diff) | |
download | brdo-a50f016991527c419595f81397f3ad67e12bea1c.tar.gz brdo-a50f016991527c419595f81397f3ad67e12bea1c.tar.bz2 |
Issue #1237252 by mfb, bfroehle, drewish, Berdir, iamEAP, drumm: Fixed DB Case Sensitivity: Allow BINARY attribute in MySQL.
Diffstat (limited to 'modules/simpletest/tests/database_test.test')
-rw-r--r-- | modules/simpletest/tests/database_test.test | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 7b15cf3fa..399e2d20f 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -3121,6 +3121,39 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase { } /** + * Test case sensitivity handling. + */ +class DatabaseCaseSensitivityTestCase extends DatabaseTestCase { + public static function getInfo() { + return array( + 'name' => 'Case sensitivity', + 'description' => 'Test handling case sensitive collation.', + 'group' => 'Database', + ); + } + + /** + * Test BINARY collation in MySQL. + */ + function testCaseSensitiveInsert() { + $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); + + $john = db_insert('test') + ->fields(array( + 'name' => 'john', // <- A record already exists with name 'John'. + 'age' => 2, + 'job' => 'Baby', + )) + ->execute(); + + $num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); + $this->assertIdentical($num_records_before + 1, (int) $num_records_after, t('Record inserts correctly.')); + $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'john'))->fetchField(); + $this->assertIdentical($saved_age, '2', t('Can retrieve after inserting.')); + } +} + +/** * Test invalid data handling. */ class DatabaseInvalidDataTestCase extends DatabaseTestCase { |