function UrlResolverTest::testDiscoverResourceUrlSkipsNonHtml
Tests that discoverResourceUrl skips non-HTML responses.
File
-
core/
modules/ media/ tests/ src/ Unit/ UrlResolverTest.php, line 82
Class
- UrlResolverTest
- Tests the oEmbed URL resolver.
Namespace
Drupal\Tests\media\UnitCode
public function testDiscoverResourceUrlSkipsNonHtml() : void {
$response = new Response(200, [
'Content-Type' => 'application/json',
], '');
$mock_handler = new MockHandler([
$response,
]);
$client = new Client([
'handler' => HandlerStack::create($mock_handler),
]);
$url_resolver = $this->createTestableUrlResolver($client);
$result = $url_resolver->discoverResourceUrl('https://example.com/some-page');
$this->assertFalse($result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.