You are here

function DatabaseMergeTestCase::testInvalidMerge in SimpleTest 7

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

File

tests/database_test.test, line 1172

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(t('InvalidMergeQueryException thrown for invalid query.'));
    return;
  }
  $this
    ->fail(t('No InvalidMergeQueryException thrown'));
}