Make WordPress Core


Ignore:
Timestamp:
12/01/2013 12:42:39 AM (13 years ago)
Author:
SergeyBiryukov
Message:

Use assertEqualSets() instead of direct array comparison.

fixes #26345

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/query.php

    r26056 r26490  
    224224                                ),
    225225                ) );
    226                 $this->assertEquals( array( $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
     226                $this->assertEqualSets( array( $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
    227227
    228228                $query = new WP_Query( array(
     
    236236                                ),
    237237                ) );
    238                 $this->assertEquals( array( $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
     238                $this->assertEqualSets( array( $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
    239239
    240240                $query = new WP_Query( array(
     
    248248                                ),
    249249                ) );
    250                 $this->assertEquals( array( $post_3, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
     250                $this->assertEqualSets( array( $post_3, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
    251251
    252252                $query = new WP_Query( array(
     
    260260                                ),
    261261                ) );
    262                 $this->assertEquals( array( $post_1 ), wp_list_pluck( $query->posts, 'ID' ) );
     262                $this->assertEqualSets( array( $post_1 ), wp_list_pluck( $query->posts, 'ID' ) );
    263263
    264264                $query = new WP_Query( array(
     
    273273
    274274                ) );
    275                 $this->assertEquals( array( $post_1, $post_2, $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
     275                $this->assertEqualSets( array( $post_1, $post_2, $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
    276276
    277277                $query = new WP_Query( array(
     
    285285                                ),
    286286                ) );
    287                 $this->assertEquals( array( $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
     287                $this->assertEqualSets( array( $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
    288288
    289289                $query = new WP_Query( array(
     
    297297                                ),
    298298                ) );
    299                 $this->assertEquals( array( $post_1, $post_2, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
     299                $this->assertEqualSets( array( $post_1, $post_2, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
    300300
    301301                $query = new WP_Query( array(
     
    309309                                ),
    310310                ) );
    311                 $this->assertEquals( array( $post_1, $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
    312 
    313                         $query = new WP_Query( array(
    314                                 'meta_query' => array(
    315                                                 array(
    316                                                         'key' => 'decimal_value',
    317                                                         'value' => '.3',
    318                                                         'compare' => 'NOT LIKE',
    319                                                         'type' => 'DECIMAL(10,2)'
    320                                                 )
    321                                         ),
    322                         ) );
    323                         $this->assertEquals( array( $post_2, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
     311                $this->assertEqualSets( array( $post_1, $post_3 ), wp_list_pluck( $query->posts, 'ID' ) );
     312
     313                $query = new WP_Query( array(
     314                        'meta_query' => array(
     315                                        array(
     316                                                'key' => 'decimal_value',
     317                                                'value' => '.3',
     318                                                'compare' => 'NOT LIKE',
     319                                                'type' => 'DECIMAL(10,2)'
     320                                        )
     321                                ),
     322                ) );
     323                $this->assertEqualSets( array( $post_2, $post_4 ), wp_list_pluck( $query->posts, 'ID' ) );
    324324
    325325                $query = new WP_Query( array(
     
    329329                        'meta_type' => 'DECIMAL(10, 2)'
    330330                ) );
    331                 $this->assertEquals( array( $post_4, $post_3, $post_2, $post_1 ), wp_list_pluck( $query->posts, 'ID' ) );
     331                $this->assertEqualSets( array( $post_4, $post_3, $post_2, $post_1 ), wp_list_pluck( $query->posts, 'ID' ) );
    332332
    333333        }
Note: See TracChangeset for help on using the changeset viewer.