You are here

public function FieldRedirectionResultBuilderLinkTest::testFieldRedirectionResultMaintenanceMode in Field Redirection 8.2

Tests the maintenance mode.

File

tests/src/Kernel/FieldRedirectionResultBuilderLinkTest.php, line 89

Class

FieldRedirectionResultBuilderLinkTest
Defines a class for testing field redirection result builder for link fields.

Namespace

Drupal\Tests\field_redirection\Kernel

Code

public function testFieldRedirectionResultMaintenanceMode() {
  $entity = $this
    ->createTestEntity([
    'field_redirect_link' => [
      'uri' => 'http://example.com',
    ],
  ]);
  $builder = \Drupal::service('field_redirection.result_builder');
  $request = Request::create('/');
  \Drupal::state()
    ->set('system.maintenance_mode', 1);
  $this
    ->assertEquals(FieldRedirectionResult::deny(), $builder
    ->buildResult($entity
    ->get('field_redirect_link'), $request, $this
    ->createUser([])));
}