function ConnectionTest::testCreateConnectionOptionsFromUrl

Tests create connection options from url.

@legacy-covers ::createConnectionOptionsFromUrl

Attributes

#[DataProvider('providerCreateConnectionOptionsFromUrl')]

Parameters

string $url: SQLite URL.

string $expected: Expected connection option.

File

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

Class

ConnectionTest
Tests Drupal\sqlite\Driver\Database\sqlite\Connection.

Namespace

Drupal\Tests\sqlite\Unit

Code

public function testCreateConnectionOptionsFromUrl(string $url, string $expected) : void {
  $sqlite_connection = new Connection($this->createMock(\PHP_VERSION_ID >= 80400 ? SqliteConnection::class : StubPDO::class), []);
  $database = $sqlite_connection->createConnectionOptionsFromUrl($url, NULL);
  $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.