public function InsertTest::testInsertLastInsertID in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/InsertTest.php \Drupal\KernelTests\Core\Database\InsertTest::testInsertLastInsertID()
Tests that inserts return the proper auto-increment ID.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ InsertTest.php, line 141
Class
- InsertTest
- Tests the insert builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testInsertLastInsertID() {
$id = $this->connection
->insert('test')
->fields([
'name' => 'Larry',
'age' => '30',
])
->execute();
$this
->assertSame('5', $id, 'Auto-increment ID returned successfully.');
}