You appear to be a bot. Output may be restricted
Description
Mimics the Ajax handling of admin-ajax.php.
Captures the output via output buffering, and if there is any, stores it in $this->_last_response.
Usage
WP_Ajax_UnitTestCase::_handleAjax( $action );
Parameters
- $action
- ( string ) required – The action to handle.
Returns
void
Source
File name: wordpress-develop-tests/phpunit/includes/testcase-ajax.php
Lines:
1 to 22 of 22
protected function _handleAjax( $action ) { // Start output buffering. ini_set( 'implicit_flush', false ); ob_start(); // Build the request. $_POST['action'] = $action; $_GET['action'] = $action; $_REQUEST = array_merge( $_POST, $_GET ); // Call the hooks. do_action( 'admin_init' ); do_action( 'wp_ajax_' . $_REQUEST['action'], null ); // Save the output. $buffer = ob_get_clean(); if ( ! empty( $buffer ) ) { $this->_last_response = $buffer; } }