You are here

public function ImageStyleWarmerGeneralTest::prepareImageStyleWarmerTests in Image Style Warmer 8

Prepare Image Style Warmer settings and file for tests.

Parameters

bool $permanent: Create permanent file for tests. (default: FALSE)

Throws

\Drupal\Core\Entity\EntityStorageException

4 calls to ImageStyleWarmerGeneralTest::prepareImageStyleWarmerTests()
ImageStyleWarmerGeneralTest::testImageStyleWarmerQueuePermanentImageFile in tests/src/Functional/ImageStyleWarmerGeneralTest.php
Test Image Style Warmer queue warming for permanent file.
ImageStyleWarmerGeneralTest::testImageStyleWarmerQueueTemporaryImageFile in tests/src/Functional/ImageStyleWarmerGeneralTest.php
Test Image Style Warmer queue warming for temporary file.
ImageStyleWarmerGeneralTest::testImageStyleWarmerUploadPermanentImageFile in tests/src/Functional/ImageStyleWarmerGeneralTest.php
Test Image Style Warmer initial warming for permanent file.
ImageStyleWarmerGeneralTest::testImageStyleWarmerUploadTemporaryImageFile in tests/src/Functional/ImageStyleWarmerGeneralTest.php
Test Image Style Warmer initial warming for temporary file.

File

tests/src/Functional/ImageStyleWarmerGeneralTest.php, line 97

Class

ImageStyleWarmerGeneralTest
Functional tests to check general function of Image Style Warmer.

Namespace

Drupal\Tests\image_style_warmer\Functional

Code

public function prepareImageStyleWarmerTests($permanent = FALSE) {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/development/performance/image-style-warmer');
  $settings = [
    'initial_image_styles[test_initial]' => 'test_initial',
    'queue_image_styles[test_queue]' => 'test_queue',
  ];
  $this
    ->drupalPostForm('admin/config/development/performance/image-style-warmer', $settings, t('Save configuration'));

  // Create an image file without usages.
  $this->testFile = $this
    ->getTestFile('image');
  $this->testFile
    ->setTemporary();
  if ($permanent) {
    $this->testFile
      ->setPermanent();
  }
  $this->testFile
    ->save();
}