function FileFieldTestBase::getLastFileId
Retrieves the fid of the last inserted file.
7 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::testFileUsage in core/
modules/ file/ tests/ src/ Functional/ FileOnTranslatedEntityTest.php  - Tests if file field tracks file usages correctly on translated nodes.
 
File
- 
              core/
modules/ file/ tests/ src/ Functional/ FileFieldTestBase.php, line 77  
Class
- FileFieldTestBase
 - Provides methods specifically for testing File module's field handling.
 
Namespace
Drupal\Tests\file\FunctionalCode
public 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.