You are here

public function ImageStyleWarmerTestBase::getTestFile in Image Style Warmer 8

Retrieves a sample file of the specified type.

Return value

\Drupal\file\FileInterface Return file entity object.

3 calls to ImageStyleWarmerTestBase::getTestFile()
ImageStyleWarmerCustomModuleTest::prepareImageStyleWarmerCustomModuleTests in tests/src/Functional/ImageStyleWarmerCustomModuleTest.php
Prepare Image Style Warmer for custom module tests.
ImageStyleWarmerDrushTest::prepareImageStyleWarmerTests in tests/src/Functional/ImageStyleWarmerDrushTest.php
Prepare Image Style Warmer settings and file for tests.
ImageStyleWarmerGeneralTest::prepareImageStyleWarmerTests in tests/src/Functional/ImageStyleWarmerGeneralTest.php
Prepare Image Style Warmer settings and file for tests.

File

tests/src/Functional/ImageStyleWarmerTestBase.php, line 84

Class

ImageStyleWarmerTestBase
Image Style Warmer test base class.

Namespace

Drupal\Tests\image_style_warmer\Functional

Code

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

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

  // Add a filesize property to files as would be read by
  // \Drupal\file\Entity\File::load().
  $this->testFile->filesize = filesize($this->testFile->uri);
  return File::create((array) $this->testFile);
}