You appear to be a bot. Output may be restricted
Description
Tests with an invalid nonce.
Usage
Tests_Ajax_Autosave::test_with_invalid_nonce();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/ajax/Autosave.php
Lines:
1 to 30 of 30
public function test_with_invalid_nonce() { wp_set_current_user( self::$admin_id ); // Set up the $_POST request. $_POST = array( 'action' => 'heartbeat', '_nonce' => wp_create_nonce( 'heartbeat-nonce' ), 'data' => array( 'wp_autosave' => array( 'post_id' => self::$post_id, '_wpnonce' => substr( md5( uniqid() ), 0, 10 ), ), ), ); // Make the request. try { $this->_handleAjax( 'heartbeat' ); } catch ( WPAjaxDieContinueException $e ) { unset( $e ); } $response = json_decode( $this->_last_response, true ); $this->assertNotEmpty( $response['wp_autosave'] ); $this->assertFalse( $response['wp_autosave']['success'] ); }