You are here

public function ConnectionTest::testCreateConnectionOptionsFromUrl in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Database/Driver/sqlite/ConnectionTest.php \Drupal\Tests\Core\Database\Driver\sqlite\ConnectionTest::testCreateConnectionOptionsFromUrl()

@covers ::createConnectionOptionsFromUrl @dataProvider providerCreateConnectionOptionsFromUrl

Parameters

string $url: SQLite URL.

string $expected: Expected connection option.

File

core/tests/Drupal/Tests/Core/Database/Driver/sqlite/ConnectionTest.php, line 24

Class

ConnectionTest
@coversDefaultClass \Drupal\Core\Database\Driver\sqlite\Connection @group Database

Namespace

Drupal\Tests\Core\Database\Driver\sqlite

Code

public function testCreateConnectionOptionsFromUrl(string $url, string $expected) {
  $root = dirname(__DIR__, 8);
  $sqlite_connection = new Connection($this
    ->createMock(StubPDO::class), []);
  $database = $sqlite_connection
    ->createConnectionOptionsFromUrl($url, $root);
  $this
    ->assertEquals('sqlite', $database['driver']);
  $this
    ->assertEquals($expected, $database['database']);
}