You are here

public function UrlConversionTest::providerInvalidArgumentsUrlConversion in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php \Drupal\Tests\Core\Database\UrlConversionTest::providerInvalidArgumentsUrlConversion()

Data provider for testGetInvalidArgumentExceptionInUrlConversion().

Return value

array Array of arrays with the following elements:

  • An invalid Url string.
  • Drupal root string.
  • The expected exception message.

File

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

Class

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

Namespace

Drupal\Tests\Core\Database

Code

public function providerInvalidArgumentsUrlConversion() {
  return [
    [
      'foo',
      '',
      "Missing scheme in URL 'foo'",
    ],
    [
      'foo',
      'bar',
      "Missing scheme in URL 'foo'",
    ],
    [
      'foo://',
      'bar',
      "Can not convert 'foo://' to a database connection, class 'Drupal\\Driver\\Database\\foo\\Connection' does not exist",
    ],
    [
      'foo://bar',
      'baz',
      "Can not convert 'foo://bar' to a database connection, class 'Drupal\\Driver\\Database\\foo\\Connection' does not exist",
    ],
    [
      'foo://bar:port',
      'baz',
      "Can not convert 'foo://bar:port' to a database connection, class 'Drupal\\Driver\\Database\\foo\\Connection' does not exist",
    ],
    [
      'foo/bar/baz',
      'bar2',
      "Missing scheme in URL 'foo/bar/baz'",
    ],
    [
      'foo://bar:baz@test1',
      'test2',
      "Can not convert 'foo://bar:baz@test1' to a database connection, class 'Drupal\\Driver\\Database\\foo\\Connection' does not exist",
    ],
  ];
}