public function OEmbedIframeControllerTest::testBadHashParameter in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/tests/src/Kernel/OEmbedIframeControllerTest.php \Drupal\Tests\media\Kernel\OEmbedIframeControllerTest::testBadHashParameter()
Tests validation of the 'hash' query string parameter.
@dataProvider providerBadHashParameter
@covers ::render
Parameters
string $hash: The 'hash' query string parameter.
File
- core/
modules/ media/ tests/ src/ Kernel/ OEmbedIframeControllerTest.php, line 49
Class
- OEmbedIframeControllerTest
- @coversDefaultClass \Drupal\media\Controller\OEmbedIframeController
Namespace
Drupal\Tests\media\KernelCode
public function testBadHashParameter($hash) {
/** @var callable $controller */
$controller = $this->container
->get('controller_resolver')
->getControllerFromDefinition('\\Drupal\\media\\Controller\\OEmbedIframeController::render');
$this
->assertIsCallable($controller);
$this
->expectException('\\Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException');
$this
->expectExceptionMessage('This resource is not available');
$request = new Request([
'url' => 'https://example.com/path/to/resource',
'hash' => $hash,
]);
$controller($request);
}