You are here

public function MergeTest::testLegacyThrowExceptionOption in Drupal 9

Tests deprecation of the 'throw_exception' option.

@group legacy

File

core/tests/Drupal/KernelTests/Core/Database/MergeTest.php, line 212

Class

MergeTest
Tests the MERGE query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testLegacyThrowExceptionOption() : void {
  $this
    ->expectDeprecation("Passing a 'throw_exception' option to %AMerge::execute is deprecated in drupal:9.2.0 and is removed in drupal:10.0.0. Always catch exceptions. See https://www.drupal.org/node/3201187");

  // This merge will fail because there is no key field specified.
  $this
    ->assertNull($this->connection
    ->merge('test_people', [
    'throw_exception' => FALSE,
  ])
    ->fields([
    'age' => 31,
    'name' => 'Tiffany',
  ])
    ->execute());
}