You are here

public function RabbitHoleBehaviorSettingsEntityMethodsTest::testSetAllowOverride 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::testSetAllowOverride()

Test that setAllowOverride works as expected.

Test that setAllowOverride works as expected (including throwing an exception if an invalid value is passed).

File

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

Class

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

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testSetAllowOverride() {
  $entity = $this
    ->createGenericTestEntity();
  $this
    ->behaviorSettingExceptionThrown($entity, 'setAllowOverride', [
    'some non-bool value',
  ], __METHOD__);
  $entity
    ->setAllowOverride(TRUE);
  $this
    ->assertTrue($entity
    ->getAllowOverride());
  $entity
    ->setAllowOverride(FALSE);
  $this
    ->assertFalse($entity
    ->getAllowOverride());
}