You are here

protected function ContentEntityAutosaveFormTestBase::getLastAutosaveTimestamp in Autosave Form 8

Returns the timestamp of the last autosave entry for the given entity ID.

Parameters

mixed $entity_id: The ID of the entity.

Return value

int|null The timestamp of the last autosave entry.

4 calls to ContentEntityAutosaveFormTestBase::getLastAutosaveTimestamp()
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::doTestSavingRestoredEntityForm in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Tests saving an entity form restored from an autosaved state.
ContentEntityAutosaveFormTestBase::makeAllEntityFormChanges in tests/src/FunctionalJavascript/ContentEntity/ContentEntityAutosaveFormTestBase.php
Executes all change steps.

File

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

Class

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

Namespace

Drupal\Tests\autosave_form\FunctionalJavascript\ContentEntity

Code

protected function getLastAutosaveTimestamp($entity_id) {
  $timestamp = \Drupal::database()
    ->select(AutosaveEntityFormStorageInterface::AUTOSAVE_ENTITY_FORM_TABLE, 't')
    ->fields('t', [
    'timestamp',
  ])
    ->condition('entity_id', $entity_id)
    ->orderBy('timestamp', 'DESC')
    ->execute()
    ->fetchField();
  return $timestamp !== FALSE ? $timestamp : NULL;
}