WordPress.org

Make WordPress Core


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

    r35242 r42343  
    2323        // Just some dummy posts to use as parents for comments
    2424        for ( $i = 1; $i <= 2; $i++ ) {
    25             $this->posts[$i] = self::factory()->post->create();
     25            $this->posts[ $i ] = self::factory()->post->create();
    2626        }
    2727
     
    4040
    4141        foreach ( $comment_dates as $comment_date => $comment_parent ) {
    42             $result = self::factory()->comment->create( array(
    43                 'comment_date'    => $comment_date,
    44                 'comment_post_ID' => $this->posts[ $comment_parent ],
    45             ) );
     42            $result = self::factory()->comment->create(
     43                array(
     44                    'comment_date'    => $comment_date,
     45                    'comment_post_ID' => $this->posts[ $comment_parent ],
     46                )
     47            );
    4648        }
    4749    }
    4850
    4951    public function _get_query_result( $args = array() ) {
    50         $args = wp_parse_args( $args, array(
    51             'post_id' => $this->posts[1],
    52             'orderby' => 'comment_ID',  // Same order they were created
    53             'order'   => 'ASC',
    54         ) );
     52        $args = wp_parse_args(
     53            $args, array(
     54                'post_id' => $this->posts[1],
     55                'orderby' => 'comment_ID',  // Same order they were created
     56                'order'   => 'ASC',
     57            )
     58        );
    5559
    5660        return get_comments( $args );
     
    5862
    5963    public function test_year() {
    60         $comments = $this->_get_query_result( array(
    61             'date_query' => array(
    62                 array(
    63                     'year' => 2008,
     64        $comments = $this->_get_query_result(
     65            array(
     66                'date_query' => array(
     67                    array(
     68                        'year' => 2008,
     69                    ),
    6470                ),
    65             ),
    66         ) );
     71            )
     72        );
    6773
    6874        $expected_dates = array(
Note: See TracChangeset for help on using the changeset viewer.