You are here

function ModuleBuilderModuleGenerationTestCase::assertHookImplementation in Module Builder 8.3

Assert a string contains a hook implementation function declaration.

Parameters

$code: The code to check for a function declaration.

$hook_name: The full name of the hook, e.g. 'hook_menu'.

$module_name: The name of the implementing module.

$message = NULL: The assertion message.

1 call to ModuleBuilderModuleGenerationTestCase::assertHookImplementation()
ModuleBuilderModuleGenerationTestCase::testModuleGeneration in tests/module_builder.test
Test generating module code.

File

tests/module_builder.test, line 337
Contains tests for the Module builder module.

Class

ModuleBuilderModuleGenerationTestCase
Test case for Module Builder module generation.

Code

function assertHookImplementation($code, $hook_name, $module_name, $message = NULL) {
  $hook_short_name = substr($hook_name, 5);
  $function_name = $module_name . '_' . $hook_short_name;
  $this
    ->assertFunction($code, $function_name, $message);
}