You are here

protected function ContentEntityAutosaveFormTestBase::getCountAutosaveEntries in Autosave Form 8

Gets the count of autosave states.

Parameters

mixed $entity_id: The ID of the entity.

Return value

int The count of autosave entries.

5 calls to ContentEntityAutosaveFormTestBase::getCountAutosaveEntries()
ContentEntityAutosaveFormTestBase::doTestAutosaveAfterFormValidationFail in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Tests the autosave message not being shown on reload after validation fail.
ContentEntityAutosaveFormTestBase::doTestAutosaveFormExistingEntity in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Tests the autosave support on entity forms.
ContentEntityAutosaveFormTestBase::doTestAutosaveStatesPurgingOnConfigEvent in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Tests that autosave states are purged on modifying a form related config.
ContentEntityAutosaveFormTestBase::doTestConcurrentEditing in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Tests concurrent editing.
ContentEntityAutosaveFormTestBase::makeAllEntityFormChanges in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Executes all change steps.

File

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

Class

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

Namespace

Drupal\Tests\autosave_form\FunctionalJavascript\ContentEntity

Code

protected function getCountAutosaveEntries($entity_id) {
  $count = \Drupal::database()
    ->select(AutosaveEntityFormStorageInterface::AUTOSAVE_ENTITY_FORM_TABLE)
    ->condition('entity_id', $entity_id)
    ->countQuery()
    ->execute()
    ->fetchField();
  return $count !== FALSE ? $count : 0;
}