function StatementTest::testSetDeprecatedProperties

Tests writing deprecated properties.

@group legacy

File

core/tests/Drupal/KernelTests/Core/Database/StatementTest.php, line 64

Class

StatementTest
Tests the Statement classes.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testSetDeprecatedProperties() : void {
    $statement = $this->connection
        ->prepareStatement('UPDATE {test} SET [age] = :age', []);
    $this->expectDeprecation('%s$allowRowCount should not be written in drupal:9.3.0 and will error in drupal:10.0.0. Enable row counting by passing the appropriate argument to the constructor instead. See https://www.drupal.org/node/3186368');
    $statement->allowRowCount = TRUE;
    $statement->execute([
        ':age' => 12,
    ]);
    $this->assertEquals(4, $statement->rowCount());
}

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