function ConnectionTest::testCreateConnectionOptionsFromUrl

Same name in other branches
  1. 9 core/modules/sqlite/tests/src/Unit/ConnectionTest.php \Drupal\Tests\sqlite\Unit\ConnectionTest::testCreateConnectionOptionsFromUrl()
  2. 8.9.x core/tests/Drupal/Tests/Core/Database/Driver/sqlite/ConnectionTest.php \Drupal\Tests\Core\Database\Driver\sqlite\ConnectionTest::testCreateConnectionOptionsFromUrl()
  3. 11.x core/modules/sqlite/tests/src/Unit/ConnectionTest.php \Drupal\Tests\sqlite\Unit\ConnectionTest::testCreateConnectionOptionsFromUrl()

@covers ::createConnectionOptionsFromUrl @dataProvider providerCreateConnectionOptionsFromUrl

Parameters

string $url: SQLite URL.

string $expected: Expected connection option.

File

core/modules/sqlite/tests/src/Unit/ConnectionTest.php, line 26

Class

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

Namespace

Drupal\Tests\sqlite\Unit

Code

public function testCreateConnectionOptionsFromUrl(string $url, string $expected) : void {
    $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']);
}

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