3 namespace Drupal\media_test_oembed;
5 use Drupal\media\OEmbed\UrlResolver as BaseUrlResolver;
8 * Overrides the oEmbed URL resolver service for testing purposes.
10 class UrlResolver extends BaseUrlResolver {
13 * Sets the endpoint URL for an oEmbed resource URL.
17 * @param string $endpoint_url
20 public static function setEndpointUrl($url, $endpoint_url) {
21 $urls = \Drupal::state()->get(static::class, []);
22 $urls[$url] = $endpoint_url;
23 \Drupal::state()->set(static::class, $urls);
29 public function getResourceUrl($url, $max_width = NULL, $max_height = NULL) {
30 $urls = \Drupal::state()->get(static::class, []);
32 if (isset($urls[$url])) {
35 return parent::getResourceUrl($url, $max_width, $max_height);