You are here

public function RabbitHoleBehaviorSettingsFormTestBase::testExistingEntityNoConfigSave 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::testExistingEntityNoConfigSave()

Test saving settings for entity that did not previously have them.

Test that an existing entity that previously didn't have settings will have settings saved when the entity form is saved.

File

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

Class

RabbitHoleBehaviorSettingsFormTestBase
Base class for the Rabbit Hole form additions tests.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testExistingEntityNoConfigSave() {
  $this
    ->createEntityBundle();
  $entity_id = $this
    ->createEntity();
  $this
    ->loadEditEntityForm($entity_id);
  $action = 'access_denied';
  $this
    ->submitForm([
    'rh_action' => $action,
  ], 'Save');
  $entity = $this
    ->loadEntity($entity_id);
  $this
    ->assertEquals($action, $entity
    ->get('rh_action')->value);
}