public function UpdateTest::testSpecialColumnUpdate in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php \Drupal\KernelTests\Core\Database\UpdateTest::testSpecialColumnUpdate()
Confirm that we can update values in a column with special name.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ UpdateTest.php, line 133
Class
- UpdateTest
- Tests the update query builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testSpecialColumnUpdate() {
$num_updated = $this->connection
->update('test_special_columns')
->fields([
'offset' => 'New offset value',
])
->condition('id', 1)
->execute();
$this
->assertIdentical($num_updated, 1, 'Updated 1 special column record.');
$saved_value = $this->connection
->query('SELECT "offset" FROM {test_special_columns} WHERE id = :id', [
':id' => 1,
])
->fetchField();
$this
->assertIdentical($saved_value, 'New offset value', 'Updated special column name value successfully.');
}