Make WordPress Core


Ignore:
Timestamp:
10/07/2022 01:02:07 AM (2 years ago)
Author:
desrosj
Message:

Tests: Replace some occurrences of assertEquals() with assertSame().

This ensures that not only the return values match the expected results, but also that their type is the same.

Props costdev, desrosj.
See #55654.

File:
1 edited

Legend:

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

    r54091 r54402  
    7676        );
    7777        // There are 5 posts, all Uncategorized.
    78         $this->assertEquals( 1, $count );
     78        $this->assertSame( '1', $count );
    7979    }
    8080
     
    8787        // Counts all terms (1 default category, 5 tags).
    8888        $count = wp_count_terms();
    89         $this->assertEquals( 6, $count );
     89        $this->assertSame( '6', $count );
    9090
    9191        // Counts only tags (5), with both current and legacy signature.
     
    9393        $count        = wp_count_terms( array( 'taxonomy' => 'post_tag' ) );
    9494        $legacy_count = wp_count_terms( 'post_tag' );
    95         $this->assertEquals( 5, $count );
    96         $this->assertEquals( $count, $legacy_count );
     95        $this->assertSame( '5', $count );
     96        $this->assertSame( $count, $legacy_count );
    9797    }
    9898
     
    160160        $this->assertNotWPError( $t );
    161161        $this->assertGreaterThan( 0, $t );
    162         $this->assertEquals( $initial_count + 1, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     162        $this->assertSame( (string) ( $initial_count + 1 ), wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    163163
    164164        // Make sure the term exists.
     
    170170        $this->assertNull( term_exists( $term ) );
    171171        $this->assertNull( term_exists( $t ) );
    172         $this->assertEquals( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     172        $this->assertSame( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    173173    }
    174174
Note: See TracChangeset for help on using the changeset viewer.