function ImageEffectsTest::testImageEffectsCaching in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/image/src/Tests/ImageEffectsTest.php \Drupal\image\Tests\ImageEffectsTest::testImageEffectsCaching()
Test image effect caching.
File
- core/
modules/ image/ src/ Tests/ ImageEffectsTest.php, line 154 - Contains \Drupal\image\Tests\ImageEffectsTest.
Class
- ImageEffectsTest
- Tests that the image effects pass parameters to the toolkit correctly.
Namespace
Drupal\image\TestsCode
function testImageEffectsCaching() {
$image_effect_definitions_called =& drupal_static('image_module_test_image_effect_info_alter');
// First call should grab a fresh copy of the data.
$manager = $this->container
->get('plugin.manager.image.effect');
$effects = $manager
->getDefinitions();
$this
->assertTrue($image_effect_definitions_called === 1, 'image_effect_definitions() generated data.');
// Second call should come from cache.
drupal_static_reset('image_module_test_image_effect_info_alter');
$cached_effects = $manager
->getDefinitions();
$this
->assertTrue($image_effect_definitions_called === 0, 'image_effect_definitions() returned data from cache.');
$this
->assertTrue($effects == $cached_effects, 'Cached effects are the same as generated effects.');
}