diff --git a/tests/phpunit/tests/ajax/wpAjaxAddMeta.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxAddMeta.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxAddMeta.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxAddMeta.php diff --git a/tests/phpunit/tests/ajax/wpAjaxAddTag.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxAddTag.php old mode 100755 new mode 100644 similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxAddTag.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxAddTag.php diff --git a/tests/phpunit/tests/ajax/wpAjaxAjaxTagSearch.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxAjaxTagSearch.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxAjaxTagSearch.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxAjaxTagSearch.php diff --git a/tests/phpunit/tests/ajax/wpAjaxCropImage.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxCropImage.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxCropImage.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxCropImage.php diff --git a/tests/phpunit/tests/ajax/wpAjaxDeleteComment.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxDeleteComment.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxDeleteComment.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxDeleteComment.php diff --git a/tests/phpunit/tests/ajax/wpAjaxDeletePlugin.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxDeletePlugin.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxDeletePlugin.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxDeletePlugin.php diff --git a/tests/phpunit/tests/ajax/wpAjaxDimComment.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxDimComment.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxDimComment.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxDimComment.php diff --git a/tests/phpunit/tests/ajax/wpAjaxEditComment.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxEditComment.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxEditComment.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxEditComment.php diff --git a/tests/phpunit/tests/ajax/wpAjaxGetComments.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxGetComments.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxGetComments.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxGetComments.php diff --git a/tests/phpunit/tests/ajax/wpAjaxHeartbeat.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxHeartbeat.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxHeartbeat.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxHeartbeat.php diff --git a/tests/phpunit/tests/ajax/wpAjaxImageEditor.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxImageEditor.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxImageEditor.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxImageEditor.php diff --git a/tests/phpunit/tests/ajax/wpAjaxInlineSave.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxInlineSave.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxInlineSave.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxInlineSave.php diff --git a/tests/phpunit/tests/ajax/wpAjaxParseMediaShortcode.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxParseMediaShortcode.php old mode 100755 new mode 100644 similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxParseMediaShortcode.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxParseMediaShortcode.php diff --git a/tests/phpunit/tests/ajax/wpAjaxReplytoComment.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxReplytoComment.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxReplytoComment.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxReplytoComment.php diff --git a/tests/phpunit/tests/ajax/wpAjaxResponse.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxResponse.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxResponse.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxResponse.php diff --git a/tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxSendAttachmentToEditor.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxSendAttachmentToEditor.php diff --git a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxUpdatePlugin.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxUpdatePlugin.php diff --git a/tests/phpunit/tests/ajax/wpAjaxUpdateTheme.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxUpdateTheme.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxUpdateTheme.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxUpdateTheme.php diff --git a/tests/phpunit/tests/ajax/wpAjaxWpPrivacyErasePersonalData.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxWpPrivacyErasePersonalData.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxWpPrivacyErasePersonalData.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxWpPrivacyErasePersonalData.php diff --git a/tests/phpunit/tests/ajax/wpAjaxWpPrivacyExportPersonalData.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxWpPrivacyExportPersonalData.php similarity index 100% rename from tests/phpunit/tests/ajax/wpAjaxWpPrivacyExportPersonalData.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpAjaxWpPrivacyExportPersonalData.php diff --git a/tests/phpunit/tests/ajax/wpCustomizeManager.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpCustomizeManager.php similarity index 100% rename from tests/phpunit/tests/ajax/wpCustomizeManager.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpCustomizeManager.php diff --git a/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php b/tests/phpunit/tests/admin/includes/ajax-actions/wpCustomizeNavMenus.php similarity index 100% rename from tests/phpunit/tests/ajax/wpCustomizeNavMenus.php rename to tests/phpunit/tests/admin/includes/ajax-actions/wpCustomizeNavMenus.php diff --git a/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php b/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php deleted file mode 100644 index c7fa70528b264..0000000000000 --- a/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php +++ /dev/null @@ -1,228 +0,0 @@ -logout(); - - // Set up a default request. - $_GET['test'] = '1'; - - // Make the request. - $this->expectException( 'WPAjaxDieStopException' ); - $this->expectExceptionMessage( '-1' ); - $this->_handleAjax( 'wp-compression-test' ); - } - - /** - * Fetch the test text - */ - public function test_text() { - - // Become an administrator. - $this->_setRole( 'administrator' ); - - // Set up a default request. - $_GET['test'] = '1'; - - // Make the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieContinueException $e ) { - unset( $e ); - } - - // Ensure we found the right match. - $this->assertStringContainsString( 'wpCompressionTest', $this->_last_response ); - } - - /** - * Fetch the test text (gzdeflate) - * - * @requires function gzdeflate - */ - public function test_gzdeflate() { - - // Become an administrator. - $this->_setRole( 'administrator' ); - - // Set up a default request. - $_GET['test'] = '2'; - - $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate'; - - // Make the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieContinueException $e ) { - unset( $e ); - } - - // Ensure we found the right match. - $this->assertStringContainsString( 'wpCompressionTest', gzinflate( $this->_last_response ) ); - } - - /** - * Fetch the test text (gzencode) - * - * @requires function gzencode - */ - public function test_gzencode() { - - // Become an administrator. - $this->_setRole( 'administrator' ); - - // Set up a default request. - $_GET['test'] = '2'; - - $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip'; - - // Make the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieContinueException $e ) { - unset( $e ); - } - - // Ensure we found the right match. - $this->assertStringContainsString( 'wpCompressionTest', $this->_gzdecode( $this->_last_response ) ); - } - - /** - * Fetch the test text (unknown encoding) - */ - public function test_unknown_encoding() { - - // Become an administrator. - $this->_setRole( 'administrator' ); - - // Set up a default request. - $_GET['test'] = '2'; - - $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown'; - - // Make the request. - $this->expectException( 'WPAjaxDieStopException' ); - $this->expectExceptionMessage( '-1' ); - $this->_handleAjax( 'wp-compression-test' ); - } - - /** - * Set the 'can_compress_scripts' site option to true - */ - public function test_set_yes() { - - // Become an administrator. - $this->_setRole( 'administrator' ); - - // Set up a default request. - $_GET['test'] = 'yes'; - - // Set the option to false. - update_site_option( 'can_compress_scripts', 0 ); - - // Make the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieStopException $e ) { - unset( $e ); - } - - // Check the site option is not changed due to lack of nonce. - $this->assertSame( 0, get_site_option( 'can_compress_scripts' ) ); - - // Add a nonce. - $_GET['_ajax_nonce'] = wp_create_nonce( 'update_can_compress_scripts' ); - - // Retry the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieStopException $e ) { - unset( $e ); - } - - // Check the site option is changed. - $this->assertSame( 1, get_site_option( 'can_compress_scripts' ) ); - } - - /** - * Set the 'can_compress_scripts' site option to false - */ - public function test_set_no() { - - // Become an administrator. - $this->_setRole( 'administrator' ); - - // Set up a default request. - $_GET['test'] = 'no'; - - // Set the option to true. - update_site_option( 'can_compress_scripts', 1 ); - - // Make the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieStopException $e ) { - unset( $e ); - } - - // Check the site option is not changed due to lack of nonce. - $this->assertSame( 1, get_site_option( 'can_compress_scripts' ) ); - - // Add a nonce. - $_GET['_ajax_nonce'] = wp_create_nonce( 'update_can_compress_scripts' ); - - // Retry the request. - try { - $this->_handleAjax( 'wp-compression-test' ); - } catch ( WPAjaxDieStopException $e ) { - unset( $e ); - } - - // Check the site option is changed. - $this->assertSame( 0, get_site_option( 'can_compress_scripts' ) ); - } - - /** - * Undo gzencode. This is ugly, but there's no stock gzdecode() function. - * - * @param string $encoded_data - * @return string - */ - protected function _gzdecode( $encoded_data ) { - - // Save the encoded data to a temp file. - $file = wp_tempnam( 'gzdecode' ); - file_put_contents( $file, $encoded_data ); - - // Flush it to the output buffer and delete the temp file. - ob_start(); - readgzfile( $file ); - unlink( $file ); - - // Save the data stop buffering. - $data = ob_get_clean(); - - // Done. - return $data; - } -}