function MysqlDriverLegacyTest::testDeprecationConnection

Same name in other branches
  1. 9 core/modules/mysql/tests/src/Kernel/mysql/MysqlDriverLegacyTest.php \Drupal\Tests\mysql\Kernel\mysql\MysqlDriverLegacyTest::testDeprecationConnection()

@covers Drupal\Core\Database\Driver\mysql\Connection

File

core/modules/mysql/tests/src/Kernel/mysql/MysqlDriverLegacyTest.php, line 36

Class

MysqlDriverLegacyTest
Tests the deprecations of the MySQL database driver classes in Core.

Namespace

Drupal\Tests\mysql\Kernel\mysql

Code

public function testDeprecationConnection() : void {
    $this->expectDeprecation('\\Drupal\\Core\\Database\\Driver\\mysql\\Connection is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The MySQL database driver has been moved to the mysql module. See https://www.drupal.org/node/3129492');
    // @todo https://www.drupal.org/project/drupal/issues/3251084 Remove setting
    // the $options parameter.
    $options['init_commands']['sql_mode'] = '';
    $connection = new Connection($this->createMock(StubPDO::class), $options);
    $this->assertInstanceOf(Connection::class, $connection);
}

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