You are here

public function RabbitHolePageRedirectActionTest::testRedirectPaths in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/RabbitHolePageRedirectActionTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHolePageRedirectActionTest::testRedirectPaths()

Test available URL patterns.

File

tests/src/Functional/RabbitHolePageRedirectActionTest.php, line 74

Class

RabbitHolePageRedirectActionTest
Test the "Page redirect" action.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testRedirectPaths() {
  $test_node = $this
    ->createTestNode();
  $this
    ->assertPageRedirect('/node', '/node');
  $this
    ->assertPageRedirect('https://example.com', 'https://example.com');
  $this
    ->assertPageRedirect('/', '/');
  $this
    ->assertPageRedirect('<front>', '/');
  $this
    ->assertPageRedirect('/<front>', '/');
  $this
    ->assertPageRedirect('internal:/node', '/node');
  $this
    ->assertPageRedirect('entity:node/' . $test_node
    ->id(), $test_node
    ->toUrl());
  $this
    ->assertPageRedirect('base:robots.txt', '/robots.txt');
  $this
    ->assertPageRedirect('route:system.401', '/system/401');
}