PHP 클래스 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.
파일 보기
프로젝트 열기: versionpress/versionpress
1 사용 예제들
공개 메소드들
비공개 메소드들
메소드 상세
public static addAction ( $tag, $fn, $priority = 10, $acceptedArgs = 1 ) |
public static addFilter ( $tag, $fn, $priority = 10, $acceptedArgs = 1 ) |
applyFilters()
공개 정적인 메소드
public static doAction ( $tag, $arg = '' ) |
public static setUp ( $type = HookMock::TRUE_HOOKS ) |