$url_resolver =
$this->
prophesize('\Drupal\media\OEmbed\UrlResolverInterface'
);
$resource_fetcher =
$this->
prophesize('\Drupal\media\OEmbed\ResourceFetcherInterface'
);
$provider =
new Provider('YouTube', 'https://youtube.com',
[ [ 'url' => 'https://youtube.com/foo',
],
]);
$resource = Resource::
rich('<iframe src="https://youtube.com/watch?feature=oembed"></iframe>', 320, 240,
$provider);
$resource_fetcher->
fetchResource(Argument::
cetera())->
willReturn($resource);
$this->container->
set('media.oembed.url_resolver',
$url_resolver->
reveal());
$this->container->
set('media.oembed.resource_fetcher',
$resource_fetcher->
reveal());
$request =
new Request([ 'url' => '',
'hash' =>
$hash,
]);
$response =
$this->container->
get('html_response.attachments_processor'
) ->
processAttachments(OEmbedIframeController::
create($this->container
) ->
render($request));