Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 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/ReplytoComment.php

    r41980 r42343  
    1818    /**
    1919     * A post with at least one comment
     20     *
    2021     * @var mixed
    2122     */
     
    2425    /**
    2526     * Draft post
     27     *
    2628     * @var mixed
    2729     */
     
    3234    public static function wpSetUpBeforeClass( $factory ) {
    3335        self::$comment_post = $factory->post->create_and_get();
    34         self::$comment_ids = $factory->comment->create_post_comments( self::$comment_post->ID, 5 );
    35         self::$draft_post = $factory->post->create_and_get( array( 'post_status' => 'draft' ) );
     36        self::$comment_ids  = $factory->comment->create_post_comments( self::$comment_post->ID, 5 );
     37        self::$draft_post   = $factory->post->create_and_get( array( 'post_status' => 'draft' ) );
    3638    }
    3739
     
    4446     * Reply as a privilged user (administrator)
    4547     * Expects test to pass
     48     *
    4649     * @return void
    4750     */
     
    5255
    5356        // Get a comment
    54         $comments = get_comments( array(
    55             'post_id' => self::$comment_post->ID
    56         ) );
    57         $comment = array_pop( $comments );
     57        $comments = get_comments(
     58            array(
     59                'post_id' => self::$comment_post->ID,
     60            )
     61        );
     62        $comment  = array_pop( $comments );
    5863
    5964        // Set up a default request
     
    8893     * Reply as a non-privileged user (subscriber)
    8994     * Expects test to fail
     95     *
    9096     * @return void
    9197     */
     
    96102
    97103        // Get a comment
    98         $comments = get_comments( array(
    99         'post_id' => self::$comment_post->ID
    100         ) );
    101         $comment = array_pop( $comments );
     104        $comments = get_comments(
     105            array(
     106                'post_id' => self::$comment_post->ID,
     107            )
     108        );
     109        $comment  = array_pop( $comments );
    102110
    103111        // Set up a default request
     
    115123     * Reply using a bad nonce
    116124     * Expects test to fail
     125     *
    117126     * @return void
    118127     */
     
    123132
    124133        // Get a comment
    125         $comments = get_comments( array(
    126             'post_id' => self::$comment_post->ID
    127         ) );
    128         $comment = array_pop( $comments );
     134        $comments = get_comments(
     135            array(
     136                'post_id' => self::$comment_post->ID,
     137            )
     138        );
     139        $comment  = array_pop( $comments );
    129140
    130141        // Set up a default request
     
    142153     * Reply to an invalid post
    143154     * Expects test to fail
     155     *
    144156     * @return void
    145157     */
     
    162174     * Reply to a draft post
    163175     * Expects test to fail
     176     *
    164177     * @return void
    165178     */
     
    182195     * Reply to a post with a simulated database failure
    183196     * Expects test to fail
     197     *
    184198     * @global $wpdb
    185199     * @return void
     
    205219            $wpdb->suppress_errors( false );
    206220            $this->fail();
    207         } catch ( WPAjaxDieStopException $e )  {
     221        } catch ( WPAjaxDieStopException $e ) {
    208222            $wpdb->suppress_errors( false );
    209223            $this->assertContains( '1', $e->getMessage() );
     
    213227    /**
    214228     * Block comments from being saved
     229     *
    215230     * @param string $sql
    216231     * @return string
     
    218233    public function _block_comments( $sql ) {
    219234        global $wpdb;
    220         if ( false !== strpos( $sql, $wpdb->comments ) && 0 === stripos( trim ( $sql ), 'INSERT INTO') ) {
     235        if ( false !== strpos( $sql, $wpdb->comments ) && 0 === stripos( trim( $sql ), 'INSERT INTO' ) ) {
    221236            return '';
    222237        }
     
    226241    /**
    227242     * Raises WP_Error after Posted a new pre comment
     243     *
    228244     * @ticket 39730
    229245     * @return void
Note: See TracChangeset for help on using the changeset viewer.