function InsertTest::testInsertLastInsertID

Tests that inserts return the proper auto-increment ID.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Database/InsertTest.php, line 133
Definition of Drupal\system\Tests\Database\InsertTest.

Class

InsertTest
Tests the insert builder.

Namespace

Drupal\system\Tests\Database

Code

function testInsertLastInsertID() {
  $id = db_insert('test')
    ->fields(array(
    'name' => 'Larry',
    'age' => '30',
  ))
    ->execute();
  $this
    ->assertIdentical($id, '5', 'Auto-increment ID returned successfully.');
}