function ImageEffectsUnitTest::testImageEffectsCaching

Test image effect caching.

File

modules/image/image.test, line 499

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 =& drupal_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.
    drupal_static_reset('image_effect_definitions');
    drupal_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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.