function ConnectionTest::testVersionAndIsMariaDb

Same name in other branches
  1. 10 core/modules/mysql/tests/src/Unit/ConnectionTest.php \Drupal\Tests\mysql\Unit\ConnectionTest::testVersionAndIsMariaDb()
  2. 11.x core/modules/mysql/tests/src/Unit/ConnectionTest.php \Drupal\Tests\mysql\Unit\ConnectionTest::testVersionAndIsMariaDb()

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

File

core/modules/mysql/tests/src/Unit/ConnectionTest.php, line 78

Class

ConnectionTest
Tests MySQL database connections.

Namespace

Drupal\Tests\mysql\Unit

Code

public function testVersionAndIsMariaDb(bool $expected_is_mariadb, string $server_version, string $expected_version) : void {
    $this->pdoStatement
        ->fetchColumn(Argument::any())
        ->shouldBeCalled()
        ->willReturn($server_version);
    $connection = $this->createConnection();
    $is_mariadb = $connection->isMariaDb();
    $version = $connection->version();
    $this->assertSame($expected_is_mariadb, $is_mariadb);
    $this->assertSame($expected_version, $version);
}

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