function RegressionTest::testRegression_310447
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testRegression_310447()
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testRegression_310447()
- 10 core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testRegression_310447()
Ensures that non-ASCII UTF-8 data is stored in the database properly.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ RegressionTest.php, line 22
Class
- RegressionTest
- Regression tests cases for the database layer.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testRegression_310447() : void {
// That's a 255 character UTF-8 string.
$job = str_repeat("é", 255);
$this->connection
->insert('test')
->fields([
'name' => $this->randomMachineName(),
'age' => 20,
'job' => $job,
])
->execute();
$from_database = $this->connection
->query('SELECT [job] FROM {test} WHERE [job] = :job', [
':job' => $job,
])
->fetchField();
$this->assertSame($job, $from_database, 'The database handles UTF-8 characters cleanly.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.