RedirectTest.php in Lightweight Directory Access Protocol (LDAP) 8.3
Same filename and directory in other branches
Namespace
Drupal\Tests\ldap_authentication\KernelFile
ldap_authentication/tests/src/Kernel/RedirectTest.phpView source
<?php
namespace Drupal\Tests\ldap_authentication\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\ldap_authentication\Controller\LdapHelpRedirect;
/**
* @group ldap
*/
class RedirectTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'externalauth',
'ldap_servers',
'ldap_authentication',
];
protected function setUp() {
parent::setUp();
$this
->installConfig('ldap_authentication');
}
/**
* Test the help controller.
*
* TrustedRedirectResponse does not actually validate the url.
*/
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());
}
}
Classes
Name | Description |
---|---|
RedirectTest | @group ldap |