You are here

public function RabbitHolePageRedirectActionTest::testRedirectCodes 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::testRedirectCodes()

Tests available redirect codes.

File

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

Class

RabbitHolePageRedirectActionTest
Test the "Page redirect" action.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testRedirectCodes() {
  $target_entity = $this
    ->createTestNode('display_page');
  $destination_path = $target_entity
    ->toUrl()
    ->toString();
  $this
    ->assertPageRedirect($destination_path, $destination_path, 301);
  $this
    ->assertPageRedirect($destination_path, $destination_path, 302);
  $this
    ->assertPageRedirect($destination_path, $destination_path, 303);

  // TODO: Figure out what should happen on 304 code.
  // $this->assertUrlRedirect(304);.
  $this
    ->assertPageRedirect($destination_path, $destination_path, 305);
  $this
    ->assertPageRedirect($destination_path, $destination_path, 307);
}