You are here

function MediaInternetTestHelper::getFileByFilename in D7 Media 7.2

Same name and namespace in other branches
  1. 7.4 modules/media_internet/tests/media_internet.test \MediaInternetTestHelper::getFileByFilename()
  2. 7.3 modules/media_internet/tests/media_internet.test \MediaInternetTestHelper::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_internet/tests/media_internet.test, line 55
Tests for media_internet.module.

Class

MediaInternetTestHelper
Provides methods specifically for testing Media Internet module's remote media handling.

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;
}