Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r42342 r42343  
    1818    /**
    1919     * List of comments
     20     *
    2021     * @var array
    2122     */
     
    2728    public function setUp() {
    2829        parent::setUp();
    29         $post_id = self::factory()->post->create();
     30        $post_id         = self::factory()->post->create();
    3031        $this->_comments = self::factory()->comment->create_post_comments( $post_id, 15 );
    3132        $this->_comments = array_map( 'get_comment', $this->_comments );
     
    3637     */
    3738    protected function _clear_post_action() {
    38         unset($_POST['id']);
    39         unset($_POST['new']);
     39        unset( $_POST['id'] );
     40        unset( $_POST['new'] );
    4041        $this->_last_response = '';
    4142    }
     
    4849     * Test as a privilged user (administrator)
    4950     * Expects test to pass
     51     *
    5052     * @param mixed $comment Comment object
    5153     * @return void
     
    6870
    6971        // Save the comment status
    70         $prev_status          = wp_get_comment_status( $comment->comment_ID );
     72        $prev_status = wp_get_comment_status( $comment->comment_ID );
    7173
    7274        // Make the request
     
    8890        // Check the status
    8991        $current = wp_get_comment_status( $comment->comment_ID );
    90         if (in_array( $prev_status, array( 'unapproved', 'spam') ) ) {
     92        if ( in_array( $prev_status, array( 'unapproved', 'spam' ) ) ) {
    9193            $this->assertEquals( 'approved', $current );
    9294        } else {
     
    9698        // The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
    9799        $comment_count = wp_count_comments( 0 );
    98         $recalc_total = $comment_count->total_comments;
     100        $recalc_total  = $comment_count->total_comments;
    99101
    100102        // Delta is not specified, it will always be 1 lower than the request
     
    102104
    103105        // Check for either possible total
    104         $this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0] , array( $total, $recalc_total ) ) );
     106        $this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], array( $total, $recalc_total ) ) );
    105107    }
    106108
     
    108110     * Test as a non-privileged user (subscriber)
    109111     * Expects test to fail
     112     *
    110113     * @param mixed $comment Comment object
    111114     * @return void
     
    135138     * Test with a bad nonce
    136139     * Expects test to fail
     140     *
    137141     * @param mixed $comment Comment object
    138142     * @return void
     
    162166     * Test with a bad id
    163167     * Expects test to fail
     168     *
    164169     * @return void
    165170     */
     
    201206    /**
    202207     * Dim a comment as an administrator (expects success)
     208     *
    203209     * @return void
    204210     */
     
    211217    /**
    212218     * Dim a comment as a subscriber (expects permission denied)
     219     *
    213220     * @return void
    214221     */
     
    220227    /**
    221228     * Dim a comment with no id
     229     *
    222230     * @return void
    223231     */
     
    229237    /**
    230238     * Dim a comment with a bad nonce
     239     *
    231240     * @return void
    232241     */
Note: See TracChangeset for help on using the changeset viewer.