Changeset 47122 for trunk/tests/phpunit/includes/testcase-ajax.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/includes/testcase-ajax.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase-ajax.php
r47041 r47122 121 121 remove_action( 'admin_init', '_maybe_update_themes' ); 122 122 123 // Register the core actions 123 // Register the core actions. 124 124 foreach ( array_merge( self::$_core_actions_get, self::$_core_actions_post ) as $action ) { 125 125 if ( function_exists( 'wp_ajax_' . str_replace( '-', '_', $action ) ) ) { … … 144 144 set_current_screen( 'ajax' ); 145 145 146 // Clear logout cookies 146 // Clear logout cookies. 147 147 add_action( 'clear_auth_cookie', array( $this, 'logout' ) ); 148 148 149 // Suppress warnings from "Cannot modify header information - headers already sent by" 149 // Suppress warnings from "Cannot modify header information - headers already sent by". 150 150 $this->_error_level = error_reporting(); 151 151 error_reporting( $this->_error_level & ~E_WARNING ); 152 152 153 // Make some posts 153 // Make some posts. 154 154 self::factory()->post->create_many( 5 ); 155 155 } … … 252 252 protected function _handleAjax( $action ) { 253 253 254 // Start output buffering 254 // Start output buffering. 255 255 ini_set( 'implicit_flush', false ); 256 256 ob_start(); 257 257 258 // Build the request 258 // Build the request. 259 259 $_POST['action'] = $action; 260 260 $_GET['action'] = $action; 261 261 $_REQUEST = array_merge( $_POST, $_GET ); 262 262 263 // Call the hooks 263 // Call the hooks. 264 264 do_action( 'admin_init' ); 265 265 do_action( 'wp_ajax_' . $_REQUEST['action'], null ); 266 266 267 // Save the output 267 // Save the output. 268 268 $buffer = ob_get_clean(); 269 269 if ( ! empty( $buffer ) ) {
Note: See TracChangeset
for help on using the changeset viewer.