Project

General

Profile

Paste
Download (1.2 KB) Statistics
| Branch: | Revision:

root / drupal7 / modules / image / tests / image_module_test.module @ bd0d4c5c

1
<?php
2

    
3
/**
4
 * @file
5
 * Provides Image module hook implementations for testing purposes.
6
 */
7

    
8
function image_module_test_file_download($uri) {
9
  if (variable_get('image_module_test_file_download', FALSE) == $uri) {
10
    return array('X-Image-Owned-By' => 'image_module_test');
11
  }
12
  if (variable_get('image_module_test_invalid_headers', FALSE) == $uri) {
13
    return array('Content-Type' => 'image/png');
14
  }
15
}
16

    
17
/**
18
 * Implements hook_image_effect_info().
19
 */
20
function image_module_test_image_effect_info() {
21
  $effects = array(
22
    'image_module_test_null' => array(
23
    'effect callback' => 'image_module_test_null_effect',
24
    ),
25
  );
26

    
27
  return $effects;
28
}
29

    
30
/**
31
 * Image effect callback; Null.
32
 *
33
 * @param $image
34
 *   An image object returned by image_load().
35
 * @param $data
36
 *   An array with no attributes.
37
 *
38
 * @return
39
 *   TRUE
40
 */
41
function image_module_test_null_effect(array &$image, array $data) {
42
  return TRUE;
43
}
44

    
45
/**
46
 * Implements hook_image_effect_info_alter().
47
 *
48
 * Used to keep a count of cache misses in image_effect_definitions().
49
 */
50
function image_module_test_image_effect_info_alter(&$effects) {
51
  $image_effects_definition_called = &drupal_static(__FUNCTION__, 0);
52
  $image_effects_definition_called++;
53
}