function AssetControllerTest::assertDeliverThrows
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Asset/AssetControllerTest.php \Drupal\KernelTests\Core\Asset\AssetControllerTest::assertDeliverThrows()
Asserts that deliver() throws a specific BadRequestHttpException.
Parameters
\Drupal\system\Controller\AssetControllerBase $controller: The asset controller to call.
\Symfony\Component\HttpFoundation\Request $request: The request to deliver.
string $filename: The aggregate filename to request.
string $expected_message: The expected exception message.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Asset/ AssetControllerTest.php, line 201
Class
- AssetControllerTest
- Tests that the asset controllers reject invalid aggregate requests.
Namespace
Drupal\KernelTests\Core\AssetCode
private function assertDeliverThrows(AssetControllerBase $controller, Request $request, string $filename, string $expected_message) : void {
try {
$controller->deliver($request, $filename);
$this->fail("Expected BadRequestHttpException: {$expected_message}");
} catch (BadRequestHttpException $e) {
$this->assertSame($expected_message, $e->getMessage());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.