public function FileFieldTestBase::getTestFile in Drupal 8
Same name in this branch
- 8 core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::getTestFile()
- 8 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::getTestFile()
Same name and namespace in other branches
- 9 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::getTestFile()
- 10 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::getTestFile()
Retrieves a sample file of the specified type.
Return value
\Drupal\file\FileInterface The new unsaved file entity.
28 calls to FileFieldTestBase::getTestFile()
- FileFieldAnonymousSubmissionTest::doTestNodeWithFileWithoutTitle in core/
modules/ file/ tests/ src/ Functional/ FileFieldAnonymousSubmissionTest.php - Helper method to test file submissions with missing node titles.
- FileFieldAnonymousSubmissionTest::testAnonymousNodeWithFile in core/
modules/ file/ tests/ src/ Functional/ FileFieldAnonymousSubmissionTest.php - Tests file submission for an anonymous visitor.
- FileFieldAttributesTest::setUp in core/
modules/ rdf/ tests/ src/ Functional/ FileFieldAttributesTest.php - FileFieldDisplayTest::testDefaultFileFieldDisplay in core/
modules/ file/ tests/ src/ Functional/ FileFieldDisplayTest.php - Tests default display of File Field.
- FileFieldDisplayTest::testDescriptionDefaultFileFieldDisplay in core/
modules/ file/ tests/ src/ Functional/ FileFieldDisplayTest.php - Tests description display of File Field.
File
- core/
modules/ file/ tests/ src/ Functional/ FileFieldTestBase.php, line 71
Class
- FileFieldTestBase
- Provides methods specifically for testing File module's field handling.
Namespace
Drupal\Tests\file\FunctionalCode
public 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 File::create((array) $file);
}