You are here

function MediaBulkUploadTestHelper::getFileByFilename in D7 Media 7.4

Same name and namespace in other branches
  1. 7.2 modules/media_bulk_upload/tests/media_bulk_upload.test \MediaBulkUploadTestHelper::getFileByFilename()
  2. 7.3 modules/media_bulk_upload/tests/media_bulk_upload.test \MediaBulkUploadTestHelper::getFileByFilename()

Get a file from the database based on its filename.

Parameters

$filename: A file filename, usually generated by $this->randomName().

$reset: (optional) Whether to reset the internal file_load() cache.

Return value

A file object matching $filename.

File

modules/media_bulk_upload/tests/media_bulk_upload.test, line 48
Tests for media_bulk_upload.module.

Class

MediaBulkUploadTestHelper
Provides methods specifically for testing Media Bulk Upload module's bulk file uploading capabilities.

Code

function getFileByFilename($filename, $reset = FALSE) {
  $files = file_load_multiple(array(), array(
    'filename' => $filename,
  ), $reset);

  // Load the first file returned from the database.
  $returned_file = reset($files);
  return $returned_file;
}