function FileFieldTestBase::getTestFile in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::getTestFile()
Retrieves a sample file of the specified type.
22 calls to FileFieldTestBase::getTestFile()
- FileFieldAttributesTest::setUp in core/
modules/ rdf/ src/ Tests/ FileFieldAttributesTest.php - Sets up a Drupal site for running functional and integration tests.
- FileFieldDisplayTest::testDefaultFileFieldDisplay in core/
modules/ file/ src/ Tests/ FileFieldDisplayTest.php - Tests default display of File Field.
- FileFieldDisplayTest::testNodeDisplay in core/
modules/ file/ src/ Tests/ FileFieldDisplayTest.php - Tests normal formatter display on node display.
- FileFieldFormatterAccessTest::testFileAccessHandler in core/
modules/ file/ src/ Tests/ FileFieldFormatterAccessTest.php - Tests the custom access handler is invoked.
- FileFieldPathTest::testUploadPath in core/
modules/ file/ src/ Tests/ FileFieldPathTest.php - Tests the normal formatter display on node display.
File
- core/
modules/ file/ src/ Tests/ FileFieldTestBase.php, line 45 - Contains \Drupal\file\Tests\FileFieldTestBase.
Class
- FileFieldTestBase
- Provides methods specifically for testing File module's field handling.
Namespace
Drupal\file\TestsCode
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
// \Drupal\file\Entity\File::load().
$file->filesize = filesize($file->uri);
return entity_create('file', (array) $file);
}