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. 10 core/modules/sqlite/tests/src/Unit/ConnectionTest.php \Drupal\Tests\sqlite\Unit\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/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']);
}

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