function FileManagedFileElementTest::getLastFileId

Same name in other branches
  1. 8.9.x core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php \Drupal\Tests\file\FunctionalJavascript\FileManagedFileElementTest::getLastFileId()
  2. 10 core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php \Drupal\Tests\file\FunctionalJavascript\FileManagedFileElementTest::getLastFileId()
  3. 11.x core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php \Drupal\Tests\file\FunctionalJavascript\FileManagedFileElementTest::getLastFileId()

Retrieves the fid of the last inserted file.

1 call to FileManagedFileElementTest::getLastFileId()
FileManagedFileElementTest::testManagedFile in core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php
Tests the managed_file element type.

File

core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php, line 112

Class

FileManagedFileElementTest
Tests the 'managed_file' element type.

Namespace

Drupal\Tests\file\FunctionalJavascript

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.