public function InsertDefaultsTest::testDefaultInsert in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php \Drupal\KernelTests\Core\Database\InsertDefaultsTest::testDefaultInsert()
- 9 core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php \Drupal\KernelTests\Core\Database\InsertDefaultsTest::testDefaultInsert()
Tests that we can run a query that uses default values for everything.
See also
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ InsertDefaultsTest.php, line 19
Class
- InsertDefaultsTest
- Tests the Insert query builder with default values.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testDefaultInsert() {
$query = $this->connection
->insert('test')
->useDefaults([
'job',
]);
$id = $query
->execute();
$job = $this->connection
->query('SELECT [job] FROM {test} WHERE [id] = :id', [
':id' => $id,
])
->fetchField();
$this
->assertSame('Undefined', $job, 'Default field value is set.');
}