public function InsertTest::testSpecialColumnInsert in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/InsertTest.php \Drupal\KernelTests\Core\Database\InsertTest::testSpecialColumnInsert()
Tests that we can INSERT INTO a special named column.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ InsertTest.php, line 200
Class
- InsertTest
- Tests the insert builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testSpecialColumnInsert() {
$this->connection
->insert('test_special_columns')
->fields([
'id' => 2,
'offset' => 'Offset value 2',
'function' => 'foobar',
])
->execute();
$result = $this->connection
->select('test_special_columns')
->fields('test_special_columns', [
'offset',
'function',
])
->condition('test_special_columns.function', 'foobar')
->execute();
$record = $result
->fetch();
$this
->assertSame('Offset value 2', $record->offset);
$this
->assertSame('foobar', $record->function);
}