public function FieldRedirectionResultBuilderLinkTest::testFieldRedirectionResult404OnEmpty in Field Redirection 8.2
Tests the 404_on_empty setting.
File
- tests/
src/ Kernel/ FieldRedirectionResultBuilderLinkTest.php, line 78
Class
- FieldRedirectionResultBuilderLinkTest
- Defines a class for testing field redirection result builder for link fields.
Namespace
Drupal\Tests\field_redirection\KernelCode
public function testFieldRedirectionResult404OnEmpty() {
$entity = $this
->createTestEntity();
$builder = \Drupal::service('field_redirection.result_builder');
$request = Request::create('/');
$this
->expectException(NotFoundHttpException::class);
$builder
->buildResult($entity
->get('field_redirect_link'), $request, $this
->createUser([]), [
'404_if_empty' => TRUE,
]);
}