function DatabaseMergeTestCase::testInvalidMerge

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

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.