PHP Класс Codeception\TestCase\WPAjaxTestCase

С версии: 3.4.0
Наследование: extends WPTestCase
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$_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_message.
_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_message.
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