1.20.x image.test | ImageEffectsUnitTest::testImageEffectsCaching() |
Test image effect caching.
File
- modules/
image/ tests/ image.test, line 368 - Tests for image.module.
Class
- ImageEffectsUnitTest
- Use the image_test.module's mock toolkit to ensure that the effects are properly passing parameters to the image toolkit.
Code
function testImageEffectsCaching() {
$image_effect_definitions_called = &backdrop_static('image_module_test_image_effect_info_alter');
// First call should grab a fresh copy of the data.
$effects = image_effect_definitions();
$this->assertTrue($image_effect_definitions_called === 1, 'image_effect_definitions() generated data.');
// Second call should come from cache.
backdrop_static_reset('image_effect_definitions');
backdrop_static_reset('image_module_test_image_effect_info_alter');
$cached_effects = image_effect_definitions();
$this->assertTrue(is_null($image_effect_definitions_called), 'image_effect_definitions() returned data from cache.');
$this->assertTrue($effects == $cached_effects, 'Cached effects are the same as generated effects.');
}