function MergeTest::testDeprecatedKeyArrayArgument

Tests deprecation of Merge::key() with array $field argument.

@group legacy

File

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

Class

MergeTest
Tests the MERGE query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDeprecatedKeyArrayArgument() : void {
    $this->expectDeprecation('Passing an array to the $field argument of Drupal\\Core\\Database\\Query\\Merge::key() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2205327');
    $this->connection
        ->merge('select')
        ->key([
        'id' => 2,
    ])
        ->execute();
    $person = $this->connection
        ->query('SELECT * FROM {select} WHERE [id] = :id', [
        ':id' => 2,
    ])
        ->fetch();
    $this->assertEquals('', $person->update);
    $this->assertEquals('2', $person->id);
}

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