1 database_test.test DatabaseInsertTestCase::testInsertLastInsertID()

Test that inserts return the proper auto-increment ID.

File

core/modules/simpletest/tests/database_test.test, line 593
Database tests.

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.');
}