function FileFieldTestBase::getTestFile

Retrieves a sample file of the specified type.

15 calls to FileFieldTestBase::getTestFile()
FileFieldDisplayTest::testNodeDisplay in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
Tests normal formatter display on node display.
FileFieldPathTest::testUploadPath in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
Tests the normal formatter display on node display.
FileFieldRevisionTest::testRevisions in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
Tests creating multiple revisions of a node and managing attached files.
FileFieldRSSContentTest::testFileFieldRSSContent in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
Tests RSS enclosure formatter display for RSS feeds.
FileFieldValidateTest::testFileExtension in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
Tests file extension checking.

... See full list

File

drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php, line 37
Definition of Drupal\file\Tests\FileFieldTestBase.

Class

FileFieldTestBase
Provides methods specifically for testing File module's field handling.

Namespace

Drupal\file\Tests

Code

function getTestFile($type_name, $size = NULL) {

  // Get a file to upload.
  $file = current($this
    ->drupalGetTestFiles($type_name, $size));

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