Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

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

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

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

    r47122 r48937  
    3737        $post = get_post( $id );
    3838
    39         $this->assertEquals( $expected, $post->post_content );
     39        $this->assertSame( $expected, $post->post_content );
    4040    }
    4141
     
    5454        $post = get_post( $id );
    5555
    56         $this->assertEquals( $expected, $post->post_content );
     56        $this->assertSame( $expected, $post->post_content );
    5757    }
    5858
     
    7171        $post = get_post( $id );
    7272
    73         $this->assertEquals( $expected, $post->post_content );
     73        $this->assertSame( $expected, $post->post_content );
    7474    }
    7575
     
    9191        $post = get_post( $id );
    9292
    93         $this->assertEquals( $expected, $post->post_content );
     93        $this->assertSame( $expected, $post->post_content );
    9494    }
    9595
     
    111111        $post = get_post( $id );
    112112
    113         $this->assertEquals( $content, $post->post_content );
     113        $this->assertSame( $content, $post->post_content );
    114114    }
    115115}
Note: See TracChangeset for help on using the changeset viewer.