function ImageFieldTestBase::getLastFileId

Same name in other branches
  1. 8.9.x core/modules/image/src/Tests/ImageFieldTestBase.php \Drupal\image\Tests\ImageFieldTestBase::getLastFileId()
  2. 8.9.x core/modules/image/tests/src/Functional/ImageFieldTestBase.php \Drupal\Tests\image\Functional\ImageFieldTestBase::getLastFileId()
  3. 10 core/modules/image/tests/src/Functional/ImageFieldTestBase.php \Drupal\Tests\image\Functional\ImageFieldTestBase::getLastFileId()
  4. 11.x core/modules/image/tests/src/Functional/ImageFieldTestBase.php \Drupal\Tests\image\Functional\ImageFieldTestBase::getLastFileId()

Retrieves the fid of the last inserted file.

1 call to ImageFieldTestBase::getLastFileId()
ImageOnTranslatedEntityTest::testSyncedImages in core/modules/image/tests/src/Functional/ImageOnTranslatedEntityTest.php
Tests synced file fields on translated nodes.

File

core/modules/image/tests/src/Functional/ImageFieldTestBase.php, line 128

Class

ImageFieldTestBase
This class provides methods specifically for testing Image's field handling.

Namespace

Drupal\Tests\image\Functional

Code

protected function getLastFileId() {
    return (int) \Drupal::entityQueryAggregate('file')->accessCheck(FALSE)
        ->aggregate('fid', 'max')
        ->execute()[0]['fid_max'];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.