function UrlResolverTest::testResourceUrlAlterHook

Same name in other branches
  1. 9 core/modules/media/tests/src/Functional/UrlResolverTest.php \Drupal\Tests\media\Functional\UrlResolverTest::testResourceUrlAlterHook()
  2. 8.9.x core/modules/media/tests/src/Functional/UrlResolverTest.php \Drupal\Tests\media\Functional\UrlResolverTest::testResourceUrlAlterHook()
  3. 11.x core/modules/media/tests/src/Functional/UrlResolverTest.php \Drupal\Tests\media\Functional\UrlResolverTest::testResourceUrlAlterHook()

Tests that hook_oembed_resource_url_alter() is invoked.

@depends testEndpointMatching

File

core/modules/media/tests/src/Functional/UrlResolverTest.php, line 90

Class

UrlResolverTest
Tests the oEmbed URL resolver service.

Namespace

Drupal\Tests\media\Functional

Code

public function testResourceUrlAlterHook() : void {
    $this->container
        ->get('module_installer')
        ->install([
        'media_test_oembed',
    ]);
    $resource_url = $this->container
        ->get('media.oembed.url_resolver')
        ->getResourceUrl('https://vimeo.com/14782834');
    $this->assertStringContainsString('altered=1', parse_url($resource_url, PHP_URL_QUERY));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.