Make WordPress Core


Ignore:
Timestamp:
06/07/2021 11:16:29 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in some newly introduced 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.

Follow-up to [50380], [50959], [50960], [50973], [50993], [51003], [51051], [51054].

See #52482.

File:
1 edited

Legend:

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

    r50384 r51079  
    17831783        update_option( 'sticky_posts', array( 1, 2, 2 ) );
    17841784        stick_post( 2 );
    1785         $this->assertEquals( array( 1, 2, 2 ), get_option( 'sticky_posts' ) );
     1785        $this->assertSameSets( array( 1, 2, 2 ), get_option( 'sticky_posts' ) );
    17861786    }
    17871787
     
    17951795        update_option( 'sticky_posts', array( 1, 2, 2 ) );
    17961796        unstick_post( 3 );
    1797         $this->assertEquals( array( 1, 2, 2 ), get_option( 'sticky_posts' ) );
     1797        $this->assertSameSets( array( 1, 2, 2 ), get_option( 'sticky_posts' ) );
    17981798    }
    17991799}
Note: See TracChangeset for help on using the changeset viewer.