From 1c4f57f425fed9bec01e558d22d1fb751881e347 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Tue, 30 Jan 2018 02:28:14 +0000 Subject: [PATCH] Remove unit tests for deprecated ajax tag search function. Fixes unit tests failing since r42614. Ammends [42614]. See #38922. git-svn-id: https://develop.svn.wordpress.org/trunk@42619 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/ajax/TagSearch.php | 155 ------------------------- 1 file changed, 155 deletions(-) delete mode 100644 tests/phpunit/tests/ajax/TagSearch.php diff --git a/tests/phpunit/tests/ajax/TagSearch.php b/tests/phpunit/tests/ajax/TagSearch.php deleted file mode 100644 index 3a4f50296c..0000000000 --- a/tests/phpunit/tests/ajax/TagSearch.php +++ /dev/null @@ -1,155 +0,0 @@ -_setRole( 'administrator' ); - - // Set up a default request - $_GET['tax'] = 'post_tag'; - $_GET['q'] = 'chat'; - - // Make the request - try { - $this->_handleAjax( 'ajax-tag-search' ); - } catch ( WPAjaxDieContinueException $e ) { - unset( $e ); - } - - // Ensure we found the right match - $this->assertEquals( $this->_last_response, 'chattels' ); - } - - /** - * Test with no results - */ - public function test_no_results() { - - // Become an administrator - $this->_setRole( 'administrator' ); - - // Set up a default request - $_GET['tax'] = 'post_tag'; - $_GET['q'] = md5( uniqid() ); - - // Make the request - // No output, so we get a stop exception - $this->setExpectedException( 'WPAjaxDieStopException', '' ); - $this->_handleAjax( 'ajax-tag-search' ); - } - - /** - * Test with commas - */ - public function test_with_comma() { - - // Become an administrator - $this->_setRole( 'administrator' ); - - // Set up a default request - $_GET['tax'] = 'post_tag'; - $_GET['q'] = 'some,nonsense, terms,chat'; // Only the last term in the list is searched - - // Make the request - try { - $this->_handleAjax( 'ajax-tag-search' ); - } catch ( WPAjaxDieContinueException $e ) { - unset( $e ); - } - - // Ensure we found the right match - $this->assertEquals( $this->_last_response, 'chattels' ); - } - - /** - * Test as a logged out user - */ - public function test_logged_out() { - - // Log out - wp_logout(); - - // Set up a default request - $_GET['tax'] = 'post_tag'; - $_GET['q'] = 'chat'; - - // Make the request - $this->setExpectedException( 'WPAjaxDieStopException', '-1' ); - $this->_handleAjax( 'ajax-tag-search' ); - } - - /** - * Test with an invalid taxonomy type - */ - public function test_invalid_tax() { - - // Become an administrator - $this->_setRole( 'administrator' ); - - // Set up a default request - $_GET['tax'] = 'invalid-taxonomy'; - $_GET['q'] = 'chat'; - - // Make the request - $this->setExpectedException( 'WPAjaxDieStopException', '0' ); - $this->_handleAjax( 'ajax-tag-search' ); - } - - /** - * Test as an unprivileged user - */ - public function test_unprivileged_user() { - - // Become an administrator - $this->_setRole( 'subscriber' ); - - // Set up a default request - $_GET['tax'] = 'post_tag'; - $_GET['q'] = 'chat'; - - // Make the request - $this->setExpectedException( 'WPAjaxDieStopException', '-1' ); - $this->_handleAjax( 'ajax-tag-search' ); - } - -}