You are here

function FileFieldAnonymousSubmission::getTestImage in Drupal 7

Generates a test image.

Return value

stdClass A file object.

2 calls to FileFieldAnonymousSubmission::getTestImage()
FileFieldAnonymousSubmission::testAnonymousNodeWithFile in modules/file/tests/file.test
Tests file submission for an anonymous visitor.
FileFieldAnonymousSubmission::_testNodeWithFileWithoutTitle in modules/file/tests/file.test
Helper method to test file submissions with missing node titles.

File

modules/file/tests/file.test, line 1867
Tests for file.module.

Class

FileFieldAnonymousSubmission
Confirm that file field submissions work correctly for anonymous visitors.

Code

function getTestImage() {

  // Get a file to upload.
  $file = current($this
    ->drupalGetTestFiles('image'));

  // Add a filesize property to files as would be read by file_load().
  $file->filesize = filesize($file->uri);
  return $file;
}