OEmbedIframeControllerTest.php in Drupal 8
File
core/modules/media/tests/src/Kernel/OEmbedIframeControllerTest.php
View source
<?php
namespace Drupal\Tests\media\Kernel;
use Symfony\Component\HttpFoundation\Request;
class OEmbedIframeControllerTest extends MediaKernelTestBase {
public function providerBadHashParameter() {
return [
'no hash' => [
'',
],
'invalid hash' => [
$this
->randomString(),
],
];
}
public function testBadHashParameter($hash) {
$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);
}
}