Tests that multi-byte UTF-8 characters are stored and retrieved correctly.
public function testMultiByteUtf8() {
$connection = Database::getConnection();
// On MySQL, this test will only run if 'charset' is set to 'utf8mb4' in
// settings.php.
if (!($connection
->utf8mb4IsSupported() && $connection
->utf8mb4IsActive())) {
return;
}
$title = '🐙';
$this
->assertTrue(drupal_strlen($title, 'utf-8') < strlen($title), 'Title has multi-byte characters.');
$node = $this
->drupalCreateNode(array(
'title' => $title,
));
$this
->drupalGet('node/' . $node->nid);
$result = $this
->xpath('//h1[@id="page-title"]');
$this
->assertEqual(trim((string) $result[0]), $title, 'The passed title was returned.');
}