summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/module_test.module
blob: 6829026a275239adacfbdf8f5940f36a31c0724b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
// $Id$

/**
 * Implements hook_permission().
 */
function module_test_permission() {
  return array(
    'module_test perm' => t('example perm for module_test module'),
  );
}

/**
 * Implements hook_system_info_alter().
 *
 * Manipulate module dependencies to test dependency chains.
 */
function module_test_system_info_alter(&$info, $file, $type) {
  if (variable_get('dependency_test', FALSE) == 'missing dependency') {
    if ($file->name == 'forum') {
      // Make forum module depend on poll.
      $info['dependencies'][] = 'poll';
    }
    elseif ($file->name == 'poll') {
      // Make poll depend on a made-up module.
      $info['dependencies'][] = 'foo';
    }
  }
  elseif (variable_get('dependency_test', FALSE) == 'dependency') {
    if ($file->name == 'forum') {
      // Make the forum module depend on poll.
      $info['dependencies'][] = 'poll';
    }
    elseif ($file->name == 'poll') {
      // Make poll depend on php module.
      $info['dependencies'][] = 'php';
    }
  }
  if ($file->name == 'seven' && $type == 'theme') {
    $info['regions']['test_region'] = t('Test region');
  }
}

/**
 * Implements hook_hook_info().
 */
function module_test_hook_info() {
  $hooks['test_hook'] = array(
    'group' => 'file',
  );
  return $hooks;
}

/**
 * Implements hook_modules_enabled().
 */
function module_test_modules_enabled($modules) {
  variable_set('test_module_enable_order', $modules);
}