You are here

protected function ContentEntityAutosaveFormTestBase::doTestSavingRestoredEntityForm in Autosave Form 8

Tests saving an entity form restored from an autosaved state.

1 call to ContentEntityAutosaveFormTestBase::doTestSavingRestoredEntityForm()
ContentEntityAutosaveFormTestBase::testAutosaveForms in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Tests autosave.

File

tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php, line 150

Class

ContentEntityAutosaveFormTestBase
Base test class for testing autosave support for entity forms.

Namespace

Drupal\Tests\autosave_form\FunctionalJavascript\ContentEntity

Code

protected function doTestSavingRestoredEntityForm() {
  $entity = $this
    ->createTestEntity();
  $entity_form_edit_url = $entity
    ->toUrl('edit-form');
  $this
    ->drupalGet($entity_form_edit_url);
  $this
    ->makeAllEntityFormChanges($entity
    ->id());

  // Assure that an autosave submission has run.
  $this
    ->assertTrue($this
    ->waitForAutosaveSubmits(1));
  $this
    ->reloadPageAndRestore($entity_form_edit_url, $this
    ->getLastAutosaveTimestamp($entity
    ->id()));
  $this
    ->saveForm();
  $this
    ->finalizeTestSavingRestoredEntityForm($entity
    ->id());
}