PHP 클래스 WP_Ajax_UnitTestCase

부터: 3.4.0
상속: extends WP_UnitTestCase
파일 보기 프로젝트 열기: lucatume/wp-browser 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_core_actions_get type List of ajax actions called via POST
$_core_actions_post type List of ajax actions called via GET
$_error_level integer Saved error reporting level
$_last_response type Last AJAX response. This is set via echo -or- wp_die.

공개 메소드들

메소드 설명
dieHandler ( string $message ) Handler for wp_die() Save the output for analysis, stop execution by throwing an exception.
getDieHandler ( ) : callback Return our callback handler
logout ( ) Clear login cookies, unset the current user
setUp ( ) Set up the test fixture.
setUpBeforeClass ( )
tearDown ( ) Tear down the test fixture.

보호된 메소드들

메소드 설명
_handleAjax ( string $action ) Mimic the ajax handling of admin-ajax.php Capture the output via output buffering, and if there is any, store it in $this->_last_response.
_setRole ( string $role ) Switch between user roles E.g. administrator, editor, author, contributor, subscriber

메소드 상세

_handleAjax() 보호된 메소드

Mimic the ajax handling of admin-ajax.php Capture the output via output buffering, and if there is any, store it in $this->_last_response.
protected _handleAjax ( string $action )
$action string

_setRole() 보호된 메소드

Switch between user roles E.g. administrator, editor, author, contributor, subscriber
protected _setRole ( string $role )
$role string

dieHandler() 공개 메소드

Error conditions (no output, just die) will throw WPAjaxDieStopException( $message ) You can test for this with: $this->setExpectedException( 'WPAjaxDieStopException', 'something contained in $message' ); Normal program termination (wp_die called at then end of output) will throw WPAjaxDieContinueException( $message ) You can test for this with: $this->setExpectedException( 'WPAjaxDieContinueException', 'something contained in $message' );
public dieHandler ( string $message )
$message string

getDieHandler() 공개 메소드

Return our callback handler
public getDieHandler ( ) : callback
리턴 callback

logout() 공개 메소드

Clear login cookies, unset the current user
public logout ( )

setUp() 공개 메소드

Override wp_die(), pretend to be ajax, and suppres E_WARNINGs
public setUp ( )

setUpBeforeClass() 공개 정적인 메소드

public static setUpBeforeClass ( )

tearDown() 공개 메소드

Reset $_POST, remove the wp_die() override, restore error reporting
public tearDown ( )

프로퍼티 상세

$_core_actions_get 보호되어 있는 정적으로 프로퍼티

List of ajax actions called via POST
protected static type $_core_actions_get
리턴 type

$_core_actions_post 보호되어 있는 정적으로 프로퍼티

List of ajax actions called via GET
protected static type $_core_actions_post
리턴 type

$_error_level 보호되어 있는 프로퍼티

Saved error reporting level
protected int $_error_level
리턴 integer

$_last_response 보호되어 있는 프로퍼티

Last AJAX response. This is set via echo -or- wp_die.
protected type $_last_response
리턴 type