You are here

public function StatementTest::testGetDeprecatedProperties in Drupal 9

Tests accessing deprecated properties.

@group legacy

File

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

Class

StatementTest
Tests the Statement classes.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testGetDeprecatedProperties() : void {
  $statement = $this->connection
    ->prepareStatement('SELECT * FROM {test}', []);
  $this
    ->expectDeprecation('%s$dbh should not be accessed in drupal:9.3.0 and will error in drupal:10.0.0. Use $this->connection instead. See https://www.drupal.org/node/3186368');
  $this
    ->assertNotNull($statement->dbh);
  $this
    ->expectDeprecation('%s$allowRowCount should not be accessed in drupal:9.3.0 and will error in drupal:10.0.0. Use $this->rowCountEnabled instead. See https://www.drupal.org/node/3186368');
  $this
    ->assertFalse($statement->allowRowCount);
}