function ResourceFetcherTest::testFetchResource
Tests resource fetching.
@covers ::fetchResource
      
    
@dataProvider providerFetchResource
Parameters
string $resource_url: The URL of the resource to fetch, relative to the base URL.
string $provider_name: The expected name of the resource provider.
string $title: The expected title of the resource.
File
- 
              core/
modules/ media/ tests/ src/ Functional/ ResourceFetcherTest.php, line 67  
Class
- ResourceFetcherTest
 - Tests the oEmbed resource fetcher service.
 
Namespace
Drupal\Tests\media\FunctionalCode
public function testFetchResource($resource_url, $provider_name, $title) {
  /** @var \Drupal\media\OEmbed\Resource $resource */
  $resource = $this->container
    ->get('media.oembed.resource_fetcher')
    ->fetchResource($resource_url);
  $this->assertInstanceOf(Resource::class, $resource);
  $this->assertSame($provider_name, $resource->getProvider()
    ->getName());
  $this->assertSame($title, $resource->getTitle());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.