PHP Class VersionPress\Tests\Utils\HookMock
It does two types of "mocking":
a) The first type simulates behavior of WordPress (TRUE_HOOKS). With this type you can call
add_filter and
apply_filters
and the registered filter will be actually executed.
b) The second type uses WP_MOCK. You can use all features of WP_MOCK if you choose it. The problem is,
WP_MOCK does not execute the registered hooks; therefore, we introduced this thin wrapper.
Usage:
Just call
HookMock::setUp with desired type of mocking in the
setUp method of your test case
and
HookMock::tearDown in the
tearDown method.
Note:
For now, this class supports only filters.
Datei anzeigen
Open project: versionpress/versionpress
Class Usage Examples
Public Methods
Private Methods
Method Details
addAction()
public static method
public static addAction ( $tag, $fn, $priority = 10, $acceptedArgs = 1 ) |
addFilter()
public static method
public static addFilter ( $tag, $fn, $priority = 10, $acceptedArgs = 1 ) |
applyFilters()
public static method
doAction()
public static method
public static doAction ( $tag, $arg = '' ) |
setUp()
public static method
public static setUp ( $type = HookMock::TRUE_HOOKS ) |
tearDown()
public static method