function UrlConversionTest::testGetInvalidArgumentGetConnectionInfoAsUrl

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php \Drupal\Tests\Core\Database\UrlConversionTest::testGetInvalidArgumentGetConnectionInfoAsUrl()
  2. 10 core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php \Drupal\Tests\Core\Database\UrlConversionTest::testGetInvalidArgumentGetConnectionInfoAsUrl()
  3. 11.x core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php \Drupal\Tests\Core\Database\UrlConversionTest::testGetInvalidArgumentGetConnectionInfoAsUrl()

Tests ::getConnectionInfoAsUrl() exception for invalid arguments.

@covers ::getConnectionInfoAsUrl

@dataProvider providerInvalidArgumentGetConnectionInfoAsUrl

Parameters

array $connection_options: The database connection information.

string $expected_exception_message: The expected exception message.

File

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

Class

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

Namespace

Drupal\Tests\Core\Database

Code

public function testGetInvalidArgumentGetConnectionInfoAsUrl(array $connection_options, $expected_exception_message) {
    Database::addConnectionInfo('default', 'default', $connection_options);
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage($expected_exception_message);
    $url = Database::getConnectionInfoAsUrl();
}

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