You are here

public function RabbitHoleBehaviorSettingsFormTestBase::testAllowOverrideValue in Rabbit Hole 2.x

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

Test Rabbit Hole settings with allowed/disallowed overrides.

File

tests/src/Functional/RabbitHoleBehaviorSettingsFormTestBase.php, line 125

Class

RabbitHoleBehaviorSettingsFormTestBase
Base class for the Rabbit Hole form additions tests.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testAllowOverrideValue() {
  $bundle_allow = $this
    ->createEntityBundle();
  $this->behaviorSettingsManager
    ->saveBehaviorSettings([
    'action' => 'access_denied',
    'allow_override' => BehaviorSettings::OVERRIDE_ALLOW,
    'redirect_code' => BehaviorSettings::REDIRECT_NOT_APPLICABLE,
  ], $this->bundleEntityTypeName, $bundle_allow);
  $this
    ->loadCreateEntityForm();
  $this
    ->assertRabbitHoleSettings();
  $bundle_disallow = $this
    ->createEntityBundle();
  $this->behaviorSettingsManager
    ->saveBehaviorSettings([
    'action' => 'access_denied',
    'allow_override' => BehaviorSettings::OVERRIDE_DISALLOW,
    'redirect_code' => BehaviorSettings::REDIRECT_NOT_APPLICABLE,
  ], $this->bundleEntityTypeName, $bundle_disallow);
  $this
    ->loadCreateEntityForm();
  $this
    ->assertNoRabbitHoleSettings();
}