function UrlConversionTest::testNoModuleSpecifiedDefaultsToDriverName

Tests that connection URL with no module name defaults to driver name.

File

core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php, line 309

Class

UrlConversionTest
Tests for database URL to/from database connection array conversions.

Namespace

Drupal\Tests\Core\Database

Code

public function testNoModuleSpecifiedDefaultsToDriverName() : void {
    $url = 'dummydb://test_user:test_pass@test_host/test_database';
    $connection_info = Database::convertDbUrlToConnectionInfo($url, $this->root, TRUE);
    $expected = [
        'driver' => 'dummydb',
        'username' => 'test_user',
        'password' => 'test_pass',
        'host' => 'test_host',
        'database' => 'test_database',
        'namespace' => 'Drupal\\dummydb\\Driver\\Database\\dummydb',
        'autoload' => 'core/modules/system/tests/modules/dummydb/src/Driver/Database/dummydb/',
        'dependencies' => [
            'mysql' => [
                'namespace' => 'Drupal\\mysql',
                'autoload' => 'core/modules/mysql/src/',
            ],
        ],
    ];
    $this->assertSame($expected, $connection_info);
}

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