You are here

public function FileFieldTestBase::getLastFileId in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::getLastFileId()
  2. 9 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::getLastFileId()

Retrieves the fid of the last inserted file.

File

core/modules/file/tests/src/Functional/FileFieldTestBase.php, line 76

Class

FileFieldTestBase
Provides methods specifically for testing File module's field handling.

Namespace

Drupal\Tests\file\Functional

Code

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