class MysqlDriverLegacyTest
Tests the deprecations of the MySQL database driver classes in Core.
@group legacy @group Database
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Database\DriverSpecificKernelTestBase implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\KernelTests\Core\Database\DriverSpecificDatabaseTestBase uses \Drupal\KernelTests\Core\Database\DatabaseTestSchemaDataTrait, \Drupal\KernelTests\Core\Database\DatabaseTestSchemaInstallTrait implements \Drupal\KernelTests\Core\Database\DriverSpecificKernelTestBase
- class \Drupal\Tests\mysql\Kernel\mysql\MysqlDriverLegacyTest implements \Drupal\KernelTests\Core\Database\DriverSpecificDatabaseTestBase
- class \Drupal\KernelTests\Core\Database\DriverSpecificDatabaseTestBase uses \Drupal\KernelTests\Core\Database\DatabaseTestSchemaDataTrait, \Drupal\KernelTests\Core\Database\DatabaseTestSchemaInstallTrait implements \Drupal\KernelTests\Core\Database\DriverSpecificKernelTestBase
- class \Drupal\KernelTests\Core\Database\DriverSpecificKernelTestBase implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MysqlDriverLegacyTest
File
-
core/
modules/ mysql/ tests/ src/ Kernel/ mysql/ MysqlDriverLegacyTest.php, line 20
Namespace
Drupal\Tests\mysql\Kernel\mysqlView source
class MysqlDriverLegacyTest extends DriverSpecificDatabaseTestBase {
/**
* @covers Drupal\Core\Database\Driver\mysql\Install\Tasks
*/
public function testDeprecationInstallTasks() {
$this->expectDeprecation('\\Drupal\\Core\\Database\\Driver\\mysql\\Install\\Tasks 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');
$tasks = new Tasks();
$this->assertInstanceOf(Tasks::class, $tasks);
}
/**
* @covers Drupal\Core\Database\Driver\mysql\Connection
*/
public function testDeprecationConnection() {
$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);
}
/**
* @covers Drupal\Core\Database\Driver\mysql\ExceptionHandler
*/
public function testDeprecationExceptionHandler() {
$this->expectDeprecation('\\Drupal\\Core\\Database\\Driver\\mysql\\ExceptionHandler 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');
$handler = new ExceptionHandler();
$this->assertInstanceOf(ExceptionHandler::class, $handler);
}
/**
* @covers Drupal\Core\Database\Driver\mysql\Insert
*/
public function testDeprecationInsert() {
$this->expectDeprecation('\\Drupal\\Core\\Database\\Driver\\mysql\\Insert 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');
$insert = new Insert($this->connection, 'test');
$this->assertInstanceOf(Insert::class, $insert);
}
/**
* @covers Drupal\Core\Database\Driver\mysql\Schema
*/
public function testDeprecationSchema() {
$this->expectDeprecation('\\Drupal\\Core\\Database\\Driver\\mysql\\Schema 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');
$schema = new Schema($this->connection);
$this->assertInstanceOf(Schema::class, $schema);
}
/**
* @covers Drupal\Core\Database\Driver\mysql\Upsert
*/
public function testDeprecationUpsert() {
$this->expectDeprecation('\\Drupal\\Core\\Database\\Driver\\mysql\\Upsert 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');
$upsert = new Upsert($this->connection, 'test');
$this->assertInstanceOf(Upsert::class, $upsert);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.