You are here

public static function UrlResolver::setEndpointUrl in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php \Drupal\media_test_oembed\UrlResolver::setEndpointUrl()

Sets the endpoint URL for an oEmbed resource URL.

Parameters

string $url: The resource URL.

string $endpoint_url: The endpoint URL.

1 call to UrlResolver::setEndpointUrl()
OEmbedFormatterTest::testRender in core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php
Tests the oEmbed field formatter.

File

core/modules/media/tests/modules/media_test_oembed/src/UrlResolver.php, line 20

Class

UrlResolver
Overrides the oEmbed URL resolver service for testing purposes.

Namespace

Drupal\media_test_oembed

Code

public static function setEndpointUrl($url, $endpoint_url) {
  $urls = \Drupal::state()
    ->get(static::class, []);
  $urls[$url] = $endpoint_url;
  \Drupal::state()
    ->set(static::class, $urls);
}