You are here

public function ProviderRepositoryTest::testNonExistingProviderDatabase in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Functional/ProviderRepositoryTest.php \Drupal\Tests\media\Functional\ProviderRepositoryTest::testNonExistingProviderDatabase()

Tests that provider discovery fails with a non-existent provider database.

@dataProvider providerNonExistingProviderDatabase

Parameters

string $providers_url: The URL of the provider database.

string $exception_message: The expected exception message.

File

core/modules/media/tests/src/Functional/ProviderRepositoryTest.php, line 67

Class

ProviderRepositoryTest
Tests the oEmbed provider repository.

Namespace

Drupal\Tests\media\Functional

Code

public function testNonExistingProviderDatabase($providers_url, $exception_message) {
  $this
    ->config('media.settings')
    ->set('oembed_providers_url', $providers_url)
    ->save();
  $this
    ->expectException(ProviderException::class);
  $this
    ->expectExceptionMessage($exception_message);
  $this->container
    ->get('media.oembed.provider_repository')
    ->getAll();
}