function MergeTest::testInvalidMerge
Tests that an invalid merge query throws an exception.
File
- 
              core/
tests/ Drupal/ KernelTests/ Core/ Database/ MergeTest.php, line 200  
Class
- MergeTest
 - Tests the MERGE query builder.
 
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testInvalidMerge() : void {
  $this->expectException(InvalidMergeQueryException::class);
  // This merge will fail because there is no key field specified.
  $this->connection
    ->merge('test_people')
    ->fields([
    'age' => 31,
    'name' => 'Tiffany',
  ])
    ->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.