You are here

protected function MediaRevisionsUiTest::loadOldestRevisionId in Media Revisions UI 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/MediaRevisionsUiTest.php \Drupal\Tests\media_revisions_ui\Functional\MediaRevisionsUiTest::loadOldestRevisionId()

Loads oldest revision id from media.

Parameters

\Drupal\Core\Entity\EntityInterface $media: Media to load revision.

Return value

int|null Returns revision id or NULL if not found.

1 call to MediaRevisionsUiTest::loadOldestRevisionId()
MediaRevisionsUiTest::testTabAccess in tests/src/Functional/MediaRevisionsUiTest.php
Tests access to media revisions tab.

File

tests/src/Functional/MediaRevisionsUiTest.php, line 214

Class

MediaRevisionsUiTest
Tests media revisions UI.

Namespace

Drupal\Tests\media_revisions_ui\Functional

Code

protected function loadOldestRevisionId(EntityInterface $media) {
  $result = $this->mediaStorage
    ->getQuery()
    ->allRevisions()
    ->condition('mid', $media
    ->id())
    ->sort('vid', 'ASC')
    ->range(NULL, 1)
    ->execute();
  return array_keys($result) ? array_keys($result)[0] : NULL;
}