protected function RabbitHolePageRedirectActionTest::assertPageRedirect in Rabbit Hole 8
Same name and namespace in other branches
- 2.x tests/src/Functional/RabbitHolePageRedirectActionTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHolePageRedirectActionTest::assertPageRedirect()
Test URL redirects (destination and redirect code).
2 calls to RabbitHolePageRedirectActionTest::assertPageRedirect()
- RabbitHolePageRedirectActionTest::testRedirectCodes in tests/
src/ Functional/ RabbitHolePageRedirectActionTest.php - Tests available redirect codes.
- RabbitHolePageRedirectActionTest::testRedirectPaths in tests/
src/ Functional/ RabbitHolePageRedirectActionTest.php - Test available URL patterns.
File
- tests/
src/ Functional/ RabbitHolePageRedirectActionTest.php, line 211
Class
- RabbitHolePageRedirectActionTest
- Test the "Page redirect" action.
Namespace
Drupal\Tests\rabbit_hole\FunctionalCode
protected function assertPageRedirect($destination_path, $expected_path, $redirect_code = 301) {
$entity = $this
->createTestNode('page_redirect');
$entity
->set('rh_redirect', $destination_path);
$entity
->set('rh_redirect_response', $redirect_code);
$entity
->save();
$this
->drupalGet($entity
->toUrl());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->addressEquals($expected_path);
}