You are here

function DatabaseInsertTestCase::testInsertLastInsertID in Drupal 7

Test that inserts return the proper auto-increment ID.

File

modules/simpletest/tests/database_test.test, line 601

Class

DatabaseInsertTestCase
Test the insert builder.

Code

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