| 1 file.test | FileLoadTest::testMultiple() | 
This will test loading file data from the database.
File
- core/modules/ simpletest/ tests/ file.test, line 2131 
- This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.
Class
- FileLoadTest
- Tests the file_load() function.
Code
function testMultiple() {
  // Create a new file entity.
  $file = $this->createFile('backdrop.txt', NULL, 'public');
  // Load by path.
  file_test_reset();
  $by_path_files = file_load_multiple(array(), array('uri' => $file->uri));
  $this->assertFileHookCalled('load');
  $this->assertEqual(1, count($by_path_files), 'file_load_multiple() returned an array of the correct size.');
  $by_path_file = reset($by_path_files);
  $this->assertTrue($by_path_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
  $this->assertEqual($by_path_file->fid, $file->fid, "Loading by filepath got the correct fid.", 'File');
  // Remove the entity cache entry for this file so that hook_file_load will
  // be called again.
  cache('entity_file')->delete($file->fid);
  // Load by fid.
  file_test_reset();
  $by_fid_files = file_load_multiple(array($file->fid), array());
  $this->assertFileHookCalled('load');
  $this->assertEqual(1, count($by_fid_files), 'file_load_multiple() returned an array of the correct size.');
  $by_fid_file = reset($by_fid_files);
  $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
  $this->assertEqual($by_fid_file->uri, $file->uri, "Loading by fid got the correct filepath.", 'File');
}
