Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/TagSearch.php

    r46586 r47122  
    22
    33/**
    4  * Admin ajax functions to be tested
     4 * Admin Ajax functions to be tested.
    55 */
    66require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
    77
    88/**
    9  * Testing ajax tag search functionality
     9 * Testing Ajax tag search functionality.
    1010 *
    1111 * @package    WordPress
     
    4343    public function test_post_tag() {
    4444
    45         // Become an administrator
     45        // Become an administrator.
    4646        $this->_setRole( 'administrator' );
    4747
    48         // Set up a default request
     48        // Set up a default request.
    4949        $_GET['tax'] = 'post_tag';
    5050        $_GET['q']   = 'chat';
    5151
    52         // Make the request
     52        // Make the request.
    5353        try {
    5454            $this->_handleAjax( 'ajax-tag-search' );
     
    5757        }
    5858
    59         // Ensure we found the right match
     59        // Ensure we found the right match.
    6060        $this->assertEquals( $this->_last_response, 'chattels' );
    6161    }
     
    6666    public function test_no_results() {
    6767
    68         // Become an administrator
     68        // Become an administrator.
    6969        $this->_setRole( 'administrator' );
    7070
    71         // Set up a default request
     71        // Set up a default request.
    7272        $_GET['tax'] = 'post_tag';
    7373        $_GET['q']   = md5( uniqid() );
    7474
    75         // Make the request
    76         // No output, so we get a stop exception
     75        // Make the request.
     76        // No output, so we get a stop exception.
    7777        $this->setExpectedException( 'WPAjaxDieStopException', '' );
    7878        $this->_handleAjax( 'ajax-tag-search' );
     
    8484    public function test_with_comma() {
    8585
    86         // Become an administrator
     86        // Become an administrator.
    8787        $this->_setRole( 'administrator' );
    8888
    89         // Set up a default request
     89        // Set up a default request.
    9090        $_GET['tax'] = 'post_tag';
    91         $_GET['q']   = 'some,nonsense, terms,chat'; // Only the last term in the list is searched
     91        $_GET['q']   = 'some,nonsense, terms,chat'; // Only the last term in the list is searched.
    9292
    93         // Make the request
     93        // Make the request.
    9494        try {
    9595            $this->_handleAjax( 'ajax-tag-search' );
     
    9898        }
    9999
    100         // Ensure we found the right match
     100        // Ensure we found the right match.
    101101        $this->assertEquals( $this->_last_response, 'chattels' );
    102102    }
     
    107107    public function test_logged_out() {
    108108
    109         // Log out
     109        // Log out.
    110110        wp_logout();
    111111
    112         // Set up a default request
     112        // Set up a default request.
    113113        $_GET['tax'] = 'post_tag';
    114114        $_GET['q']   = 'chat';
    115115
    116         // Make the request
     116        // Make the request.
    117117        $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    118118        $this->_handleAjax( 'ajax-tag-search' );
     
    124124    public function test_invalid_tax() {
    125125
    126         // Become an administrator
     126        // Become an administrator.
    127127        $this->_setRole( 'administrator' );
    128128
    129         // Set up a default request
     129        // Set up a default request.
    130130        $_GET['tax'] = 'invalid-taxonomy';
    131131        $_GET['q']   = 'chat';
    132132
    133         // Make the request
     133        // Make the request.
    134134        $this->setExpectedException( 'WPAjaxDieStopException', '0' );
    135135        $this->_handleAjax( 'ajax-tag-search' );
     
    141141    public function test_unprivileged_user() {
    142142
    143         // Become an administrator
     143        // Become a subscriber.
    144144        $this->_setRole( 'subscriber' );
    145145
    146         // Set up a default request
     146        // Set up a default request.
    147147        $_GET['tax'] = 'post_tag';
    148148        $_GET['q']   = 'chat';
    149149
    150         // Make the request
     150        // Make the request.
    151151        $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    152152        $this->_handleAjax( 'ajax-tag-search' );
Note: See TracChangeset for help on using the changeset viewer.