class ModuleStub in Authenticated User Page Caching (Authcache) 7.2
Helper class representing a stub-module.
Hierarchy
- class \ModuleStub
Expanded class hierarchy of ModuleStub
File
- tests/
HookStub.inc, line 10 - Defines some helper classes for stubbing and recording hook invocations.
View source
class ModuleStub {
protected $name;
/**
* Construct a new module stub-helper.
*
* @param string $name
* The name of an existing stub-module, e.g., mymodule_test
*/
public function __construct($name) {
$this->name = $name;
}
/**
* Install a stub for a hook-implementation.
*
* @param string $hookname
* The name of the hook (without the module prefix). E.g. form_alter, if
* the stub-module has an implementation of hook_form_alter.
*
* @param any $return
* The result which should be returned when the hook is invoked.
*
* @return HookStubProxy
* A proxy object representing the stubbed hook.
*/
public function hook($hookname, $return = NULL) {
return HookStub::on($this->name . '_' . $hookname, $return);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ModuleStub:: |
protected | property | ||
ModuleStub:: |
public | function | Install a stub for a hook-implementation. | |
ModuleStub:: |
public | function | Construct a new module stub-helper. |