You are here

public function RedirectUITest::testExternal in Redirect 8

Test external destinations.

File

tests/src/Functional/RedirectUITest.php, line 263

Class

RedirectUITest
UI tests for redirect module.

Namespace

Drupal\Tests\redirect\Functional

Code

public function testExternal() {
  $redirect = $this->storage
    ->create();
  $redirect
    ->setSource('a-path');

  // @todo Redirect::setRedirect() assumes that all redirects are internal.
  $redirect->redirect_redirect
    ->set(0, [
    'uri' => 'https://www.example.org',
  ]);
  $redirect
    ->setStatusCode(301);
  $redirect
    ->save();
  $this
    ->assertRedirect('a-path', 'https://www.example.org');
  $this
    ->drupalLogin($this->adminUser);
}