You are here

public function FileFieldTestBase::getLastFileId in Drupal 8

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

Retrieves the fid of the last inserted file.

6 calls to FileFieldTestBase::getLastFileId()
FileManagedFileElementTest::testFileNameTrim in core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
Tests file names have leading . removed.
FileManagedFileElementTest::testFileRemovedFromDisk in core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
Ensure a file entity can be saved when the file does not exist on disk.
FileManagedFileElementTest::testManagedFile in core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
Tests the managed_file element type.
FileManagedFileElementTest::testManagedFileRemoved in core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
Ensure that warning is shown if file on the field has been removed.
FileOnTranslatedEntityTest::testSyncedFiles in core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php
Tests synced file fields on translated nodes.

... See full list

File

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

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')
    ->aggregate('fid', 'max')
    ->execute()[0]['fid_max'];
}