Make WordPress Core

Changeset 55264

Timestamp:
02/07/2023 02:58:08 PM (18 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSameSets() in WP_Query tests for search_columns argument.

This aims to resolve intermittent test failures due to indeterminate sort order.

Follow-up to [55248].

Props petitphp, costdev, audrasjb, johnbillion.
Fixes #43867.

File:
1 edited

Legend:

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

    r55248 r55264  
    9292        $this->assertStringContainsString( 'post_excerpt', $q->request, 'SQL request should contain post_excerpt string.' );
    9393        $this->assertStringContainsString( 'post_content', $q->request, 'SQL request should contain post_content string.' );
    94         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
     94        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
    9595    }
    9696
     
    109109        );
    110110
    111         $this->assertSame( array( self::$pid1 ), $q->posts );
     111        $this->assertSame( array( self::$pid1 ), $q->posts );
    112112    }
    113113
     
    126126        );
    127127
    128         $this->assertSame( array( self::$pid1, self::$pid2 ), $q->posts );
     128        $this->assertSame( array( self::$pid1, self::$pid2 ), $q->posts );
    129129    }
    130130
     
    142142            )
    143143        );
    144         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
     144        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
    145145    }
    146146
     
    159159        );
    160160
    161         $this->assertSame( array( self::$pid1, self::$pid2 ), $q->posts );
     161        $this->assertSame( array( self::$pid1, self::$pid2 ), $q->posts );
    162162    }
    163163
     
    176176        );
    177177
    178         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
     178        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
    179179    }
    180180
     
    193193        );
    194194
    195         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
     195        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
    196196    }
    197197
     
    210210        );
    211211
    212         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
     212        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts );
    213213    }
    214214
     
    230230        $this->assertStringContainsString( 'post_excerpt', $q->request, 'SQL request should contain post_excerpt string.' );
    231231        $this->assertStringContainsString( 'post_content', $q->request, 'SQL request should contain post_content string.' );
    232         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
     232        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
    233233    }
    234234
     
    247247        );
    248248
    249         $this->assertSame( array( self::$pid1 ), $q->posts );
     249        $this->assertSame( array( self::$pid1 ), $q->posts );
    250250    }
    251251
     
    264264        );
    265265
    266         $this->assertSame( array( self::$pid2, self::$pid3 ), $q->posts );
     266        $this->assertSame( array( self::$pid2, self::$pid3 ), $q->posts );
    267267    }
    268268
     
    282282        );
    283283
    284         $this->assertSame( array( self::$pid3 ), $q->posts );
     284        $this->assertSame( array( self::$pid3 ), $q->posts );
    285285    }
    286286
     
    300300        );
    301301
    302         $this->assertSame( array( self::$pid2, self::$pid3 ), $q->posts );
     302        $this->assertSame( array( self::$pid2, self::$pid3 ), $q->posts );
    303303    }
    304304
     
    317317        );
    318318
    319         $this->assertSame( array( self::$pid2 ), $q->posts );
     319        $this->assertSame( array( self::$pid2 ), $q->posts );
    320320    }
    321321
     
    334334        );
    335335
    336         $this->assertSame( array( self::$pid1 ), $q->posts );
     336        $this->assertSame( array( self::$pid1 ), $q->posts );
    337337    }
    338338
     
    365365
    366366        $this->assertStringNotContainsString( 'post_name', $q->request, "SQL request shouldn't contain post_name string." );
    367         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
     367        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
    368368    }
    369369
     
    396396
    397397        $this->assertStringNotContainsString( 'post_non_existing_column', $q->request, "SQL request shouldn't contain post_non_existing_column string." );
    398         $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
     398        $this->assertSame( array( self::$pid1, self::$pid2, self::$pid3 ), $q->posts, 'Query results should be equal to the set.' );
    399399    }
    400400
Note: See TracChangeset for help on using the changeset viewer.