Make WordPress Core

Changeset 733 in tests


Ignore:
Timestamp:
06/04/2012 08:38:11 PM (14 years ago)
Author:
kurtpayne
Message:

New test cases for tags searches with commas and tag searches with no results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test-ajax-actions/test_admin_ajax_tag_search.php

    r723 r733  
    3232        $_GET['tax'] = 'post_tag';
    3333        $_GET['q']   = 'chat';
     34
     35        // Make the request
     36        try {
     37            $this->_handleAjax( 'ajax-tag-search' );
     38        } catch ( WPAjaxDieContinueException $e ) {
     39            unset( $e );
     40        }
     41       
     42        // Ensure we found the right match
     43        $this->assertEquals( $this->_last_response, 'chattels' );
     44    }
     45
     46    /**
     47     * Test with no results
     48     */
     49    public function test_no_results() {
     50
     51        // Become an administrator
     52        $this->_setRole( 'administrator' );
     53
     54        // Set up a default request
     55        $_GET['tax'] = 'post_tag';
     56        $_GET['q']   = md5(uniqid());
     57
     58        // Make the request
     59        // No output, so we get a stop exception
     60        $this->setExpectedException( 'WPAjaxDieStopException', '0' );
     61        $this->_handleAjax( 'ajax-tag-search' );
     62    }
     63
     64    /**
     65     * Test with commas
     66     */
     67    public function test_with_comma() {
     68
     69        // Become an administrator
     70        $this->_setRole( 'administrator' );
     71
     72        // Set up a default request
     73        $_GET['tax'] = 'post_tag';
     74        $_GET['q']   = 'some,nonsense, terms,chat'; // Only the last term in the list is searched
    3475
    3576        // Make the request
Note: See TracChangeset for help on using the changeset viewer.