Make WordPress Core


Ignore:
Timestamp:
02/18/2024 06:59:24 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in WP_Query tests involving ::$max_num_pages property.

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 [48937], [54402], [54768], [57648].

Props costdev.
See #58683, #59655.

File:
1 edited

Legend:

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

    r56513 r57653  
    632632
    633633        $this->assertSame( 2, $q->found_posts );
    634         $this->assertEquals( 2, $q->max_num_pages );
     634        $this->assertSame( 2, $q->max_num_pages );
    635635    }
    636636
     
    655655
    656656        $this->assertSame( 2, $q->found_posts );
    657         $this->assertEquals( 2, $q->max_num_pages );
     657        $this->assertSame( 2, $q->max_num_pages );
    658658    }
    659659
     
    681681
    682682        $this->assertSame( 2, $q->found_posts );
    683         $this->assertEquals( 2, $q->max_num_pages );
     683        $this->assertSame( 2, $q->max_num_pages );
    684684    }
    685685
     
    708708
    709709        $this->assertSame( 2, $q->found_posts );
    710         $this->assertEquals( 2, $q->max_num_pages );
     710        $this->assertSame( 2, $q->max_num_pages );
    711711    }
    712712
Note: See TracChangeset for help on using the changeset viewer.