protected function ContentEntityAutosaveFormTestBase::finalizeTestSavingRestoredEntityForm in Autosave Form 8
Tests correctly saved entity after autosave restore.
Helper method for ::doTestSavingRestoredEntityForm() to test the saved entity.
Parameters
mixed $entity_id: The ID of the entity.
1 call to ContentEntityAutosaveFormTestBase::finalizeTestSavingRestoredEntityForm()
- ContentEntityAutosaveFormTestBase::doTestSavingRestoredEntityForm in tests/
src/ FunctionalJavascript/ ContentEntity/ ContentEntityAutosaveFormTestBase.php - Tests saving an entity form restored from an autosaved state.
File
- tests/
src/ FunctionalJavascript/ ContentEntity/ ContentEntityAutosaveFormTestBase.php, line 340
Class
- ContentEntityAutosaveFormTestBase
- Base test class for testing autosave support for entity forms.
Namespace
Drupal\Tests\autosave_form\FunctionalJavascript\ContentEntityCode
protected function finalizeTestSavingRestoredEntityForm($entity_id) {
$entity = $this
->reloadEntity($entity_id);
// Change 1.
$this
->assertEquals($entity
->label(), $this->changedEntityTitle);
// Changes 2, 3 and 4.
$this
->assertEquals(2, $entity
->get($this->unlimitedCardinalityField)
->count());
$this
->assertEquals('delta 0', $entity
->get($this->unlimitedCardinalityField)
->get(0)->value);
$this
->assertEquals('delta 1', $entity
->get($this->unlimitedCardinalityField)
->get(1)->value);
// Change 5.
$this
->assertEquals('required test field', $entity
->get($this->requiredField)
->get(0)->value);
}