You are here

public function RabbitHoleBehaviorSettingsFormTestBase::testExistingEntitySave in Rabbit Hole 8

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

Test that existing entity is edited on saving the entity form.

File

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

Class

RabbitHoleBehaviorSettingsFormTestBase
Base class for the Rabbit Hole form additions tests.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testExistingEntitySave() {
  $this
    ->createEntityBundle();
  $entity_id = $this
    ->createEntity('display_page');
  $this
    ->loadEditEntityForm($entity_id);
  $action = 'access_denied';
  $this
    ->submitForm([
    'rh_action' => $action,
  ], 'Save');

  // Make sure the editor didn't hit error page after the form save.
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $entity = $this
    ->loadEntity($entity_id);
  $this
    ->assertEquals($action, $entity
    ->get('rh_action')->value);
}