You are here

public function ConnectionTest::testVersionAndIsMariaDb in Drupal 9

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php \Drupal\Tests\Core\Database\Driver\mysql\ConnectionTest::testVersionAndIsMariaDb()

@covers ::version @covers ::isMariaDb @dataProvider providerVersionAndIsMariaDb

File

core/tests/Drupal/Tests/Core/Database/Driver/mysql/ConnectionTest.php, line 61

Class

ConnectionTest
Tests MySQL database connections.

Namespace

Drupal\Tests\Core\Database\Driver\mysql

Code

public function testVersionAndIsMariaDb(bool $expected_is_mariadb, string $server_version, string $expected_version) : void {
  $this->pdoStatement
    ->fetchColumn()
    ->shouldBeCalled()
    ->willReturn($server_version);
  $this->pdoConnection
    ->query('SELECT VERSION()')
    ->shouldBeCalled()
    ->willReturn($this->pdoStatement
    ->reveal());
  $connection = $this
    ->createConnection();
  $is_mariadb = $connection
    ->isMariaDb();
  $version = $connection
    ->version();
  $this
    ->assertSame($expected_is_mariadb, $is_mariadb);
  $this
    ->assertSame($expected_version, $version);
}