You are here

protected function MediaEntitySlideshowTest::getTestFile in Media entity slideshow 8

Retrieves a sample file of the specified type.

Return value

\Drupal\file\FileInterface A file object recently created and saved.

1 call to MediaEntitySlideshowTest::getTestFile()
MediaEntitySlideshowTest::createMediaImageCollection in src/Tests/MediaEntitySlideshowTest.php
Creates an array of media images to be used in testing.

File

src/Tests/MediaEntitySlideshowTest.php, line 172

Class

MediaEntitySlideshowTest
Tests for media entity slideshow.

Namespace

Drupal\media_entity_slideshow\Tests

Code

protected function getTestFile($type_name, $size = NULL) {
  $file = current($this
    ->drupalGetTestFiles($type_name, $size));
  $file->filesize = filesize($file->uri);

  /** @var FileInterface $file */
  $file = File::create((array) $file);
  $file
    ->setPermanent();
  $file
    ->save();
  return $file;
}