You are here

public function RabbitHoleBehaviorSettingsEntityMethodsTest::testSetRedirectPath in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/RabbitHoleBehaviorSettingsEntityMethodsTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorSettingsEntityMethodsTest::testSetRedirectPath()

Test that setRedirectPath works as expected.

Test that setRedirectPath works as expected (including throwing an exception for invalid codes and settings codes when action type is wrong).

File

tests/src/Functional/RabbitHoleBehaviorSettingsEntityMethodsTest.php, line 134

Class

RabbitHoleBehaviorSettingsEntityMethodsTest
Test the functionality of the rabbit hole form additions to the node form.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testSetRedirectPath() {
  $entity = $this
    ->createGenericTestEntity();
  $entity
    ->setAction('display_page');
  $this
    ->behaviorSettingExceptionThrown($entity, 'setRedirectPath', [
    '/',
  ], __METHOD__);
  $entity
    ->setAction('redirect');
  $path = '/somepage';
  $entity
    ->setRedirectPath($path);
  $this
    ->assertEquals($path, $entity
    ->getRedirectPath());
}