function DatabaseRegressionTestCase::testRegression_310447 in Drupal 7
Regression test for #310447.
Tries to insert non-ascii UTF-8 data in a database column and checks if its stored properly.
File
- modules/
simpletest/ tests/ database_test.test, line 2923
Class
- DatabaseRegressionTestCase
- Regression tests.
Code
function testRegression_310447() {
// That's a 255 character UTF-8 string.
$name = str_repeat("é", 255);
db_insert('test')
->fields(array(
'name' => $name,
'age' => 20,
'job' => 'Dancer',
))
->execute();
$from_database = db_query('SELECT name FROM {test} WHERE name = :name', array(
':name' => $name,
))
->fetchField();
$this
->assertIdentical($name, $from_database, "The database handles UTF-8 characters cleanly.");
}