WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (2 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertSame( [number], count( ... ) ) with assertCount() to use native PHPUnit functionality.

Follow-up to [51335], [51337].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/wpSetObjectTerms.php

    r51331 r51367  
    114114            $tt = wp_set_object_terms( $id, array_values( $term_id ), $this->taxonomy );
    115115            // Should return three term taxonomy IDs.
    116             $this->assertSame( 3, count( $tt ) );
     116            $this->assertCount( 3, $tt );
    117117        }
    118118
     
    142142            $tt = wp_set_object_terms( $id, $terms, $this->taxonomy );
    143143            // Should return three term taxonomy IDs.
    144             $this->assertSame( 3, count( $tt ) );
     144            $this->assertCount( 3, $tt );
    145145            // Remember which term has which term_id.
    146146            for ( $i = 0; $i < 3; $i++ ) {
     
    269269        // Set the initial terms.
    270270        $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
    271         $this->assertSame( 3, count( $tt_1 ) );
     271        $this->assertCount( 3, $tt_1 );
    272272
    273273        // Make sure they're correct.
     
    284284        // Change the terms.
    285285        $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
    286         $this->assertSame( 2, count( $tt_2 ) );
     286        $this->assertCount( 2, $tt_2 );
    287287
    288288        // Make sure they're correct.
     
    313313        // Set the initial terms.
    314314        $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
    315         $this->assertSame( 3, count( $tt_1 ) );
     315        $this->assertCount( 3, $tt_1 );
    316316
    317317        // Make sure they're correct.
     
    328328        // Change the terms.
    329329        $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
    330         $this->assertSame( 2, count( $tt_2 ) );
     330        $this->assertCount( 2, $tt_2 );
    331331
    332332        // Make sure they're correct.
Note: See TracChangeset for help on using the changeset viewer.