public function ImageStyleWarmerCustomModuleTest::prepareImageStyleWarmerCustomModuleTests in Image Style Warmer 8
Prepare Image Style Warmer for custom module tests.
Throws
\Drupal\Core\Entity\EntityStorageException
2 calls to ImageStyleWarmerCustomModuleTest::prepareImageStyleWarmerCustomModuleTests()
- ImageStyleWarmerCustomModuleTest::testImageStyleWarmerDoWarmUpCustomModule in tests/
src/ Functional/ ImageStyleWarmerCustomModuleTest.php - Test Image Style Warmer warming like a custom module.
- ImageStyleWarmerCustomModuleTest::testImageStyleWarmerQueueCustomModule in tests/
src/ Functional/ ImageStyleWarmerCustomModuleTest.php - Test Image Style Warmer queue warming like a custom module.
File
- tests/
src/ Functional/ ImageStyleWarmerCustomModuleTest.php, line 83
Class
- ImageStyleWarmerCustomModuleTest
- Functional tests to check Image Style Warmer usage like a custom module.
Namespace
Drupal\Tests\image_style_warmer\FunctionalCode
public function prepareImageStyleWarmerCustomModuleTests() {
// Disable image styles in image_style_warmer.settings.
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/config/development/performance/image-style-warmer');
$settings = [];
$this
->drupalPostForm('admin/config/development/performance/image-style-warmer', $settings, t('Save configuration'));
// Create an Image Styles Warmer service.
$this->testService = \Drupal::service('image_style_warmer.warmer');
// Create an image file.
$this->testFile = $this
->getTestFile('image');
$this->testFile
->setPermanent();
$this->testFile
->save();
}