Make WordPress Core


Ignore:
Timestamp:
10/07/2022 01:02:07 AM (4 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/import/import.php

    r53864 r54402  
    6363
    6464                // Check that terms were imported correctly.
    65                 $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    66                 $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
     65                $this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     66                $this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
    6767                $foo = get_term_by( 'slug', 'foo', 'category' );
    6868                $this->assertSame( 0, $foo->parent );
    … …  
    7373                // Check that posts/pages were imported correctly.
    7474                $post_count = wp_count_posts( 'post' );
    75                 $this->assertEquals( 5, $post_count->publish );
    76                 $this->assertEquals( 1, $post_count->private );
     75                $this->assertSame( '5', $post_count->publish );
     76                $this->assertSame( '1', $post_count->private );
    7777                $page_count = wp_count_posts( 'page' );
    78                 $this->assertEquals( 4, $page_count->publish );
    79                 $this->assertEquals( 1, $page_count->draft );
     78                $this->assertSame( '4', $page_count->publish );
     79                $this->assertSame( '1', $page_count->draft );
    8080                $comment_count = wp_count_comments();
    8181                $this->assertSame( 1, $comment_count->total_comments );
    … …  
    231231                $this->assertSame( 'author@example.org', $author->user_email );
    232232
    233                 $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    234                 $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
     233                $this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     234                $this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
    235235                $foo = get_term_by( 'slug', 'foo', 'category' );
    236236                $this->assertSame( 0, $foo->parent );
    … …  
    240240
    241241                $post_count = wp_count_posts( 'post' );
    242                 $this->assertEquals( 5, $post_count->publish );
    243                 $this->assertEquals( 1, $post_count->private );
     242                $this->assertSame( '5', $post_count->publish );
     243                $this->assertSame( '1', $post_count->private );
    244244                $page_count = wp_count_posts( 'page' );
    245                 $this->assertEquals( 4, $page_count->publish );
    246                 $this->assertEquals( 1, $page_count->draft );
     245                $this->assertSame( '4', $page_count->publish );
     246                $this->assertSame( '1', $page_count->draft );
    247247                $comment_count = wp_count_comments();
    248248                $this->assertSame( 1, $comment_count->total_comments );
Note: See TracChangeset for help on using the changeset viewer.