You are here

public function RedirectTest::testRedirectController in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_authentication/tests/src/Kernel/RedirectTest.php \Drupal\Tests\ldap_authentication\Kernel\RedirectTest::testRedirectController()

Test the help controller.

TrustedRedirectResponse does not actually validate the url.

File

ldap_authentication/tests/src/Kernel/RedirectTest.php, line 41

Class

RedirectTest
Redirect tests.

Namespace

Drupal\Tests\ldap_authentication\Kernel

Code

public function testRedirectController() : void {
  $controller = LdapHelpRedirect::create($this->container);
  $config = $this
    ->config('ldap_authentication.settings');
  $config
    ->set('ldapUserHelpLinkUrl', 'https://www.example.com/123.html');
  $config
    ->save();
  $redirect = $controller
    ->redirectUrl();
  self::assertEquals('https://www.example.com/123.html', $redirect
    ->getTargetUrl());
  self::assertEquals(0, $redirect
    ->getAge());
  self::assertEquals(0, $redirect
    ->getCacheableMetadata()
    ->getCacheMaxAge());
}