You are here

public function VariableCheckUnitTestCase::testVariableCheckHooks in Variable Check 7

Check that the hooks return non-empty arrays.

File

./variablecheck.test, line 114
Tests for Variablecheck.

Class

VariableCheckUnitTestCase
Unit tests for the variablecheck module.

Code

public function testVariableCheckHooks() {

  // Ensure the hooks exist and return non-empty arrays.
  $hooks = array(
    'menu' => TRUE,
    'permission' => TRUE,
    'requirements' => FALSE,
  );
  foreach ($hooks as $hook => $test) {
    $callback = 'variablecheck_' . $hook;
    $this
      ->assertTrue(is_callable($callback), 'The ' . $callback . ' hook can be called.');
    if ($test) {
      $result = call_user_func($callback);
      $this
        ->assertTrue(is_array($result), 'The ' . $callback . ' hook returns an array.');
      $this
        ->assertFalse(empty($result), 'The ' . $callback . ' hook does not return an empty array.');
    }
  }
}