1 database_test.test DatabaseMergeTestCase::testInvalidMerge()

Test that an invalid merge query throws an exception like it is supposed to.

File

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

Class

DatabaseMergeTestCase
Test the MERGE query builder.

Code

function testInvalidMerge() {
  try {
    // This query should die because there is no key field specified.
    db_merge('test_people')
      ->fields(array(
        'age' => 31,
        'name' => 'Tiffany',
      ))
      ->execute();
  }
  catch (InvalidMergeQueryException $e) {
    $this->pass('InvalidMergeQueryException thrown for invalid query.');
    return;
  }
  $this->fail('No InvalidMergeQueryException thrown');
}