Make WordPress Core


Ignore:
Timestamp:
12/28/2025 10:57:37 PM (9 months 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 [60490], [60524].

See #64324.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/feed/fetchFeed.php

    r60524 r61413  
    5252
    5353                fetch_feed( 'https://wordpress.org/news/feed/' );
    54                 $this->assertEquals( 1, $filter->get_call_count(), 'The feed should be fetched on the first call.' );
     54                $this->assertSame( 1, $filter->get_call_count(), 'The feed should be fetched on the first call.' );
    5555
    5656                fetch_feed( 'https://wordpress.org/news/feed/' );
    57                 $this->assertEquals( 1, $filter->get_call_count(), 'The feed should be cached on the second call. For SP 1.8.x upgrades, backport simplepie/simplepie#830 to resolve.' );
     57                $this->assertSame( 1, $filter->get_call_count(), 'The feed should be cached on the second call. For SP 1.8.x upgrades, backport simplepie/simplepie#830 to resolve.' );
    5858        }
    5959
    … …  
    8080
    8181                fetch_feed( 'https://wordpress.org/news/feed/' );
    82                 $this->assertEquals( 1, $filter->get_call_count(), 'The feed cache should be global.' );
     82                $this->assertSame( 1, $filter->get_call_count(), 'The feed cache should be global.' );
    8383        }
    8484
Note: See TracChangeset for help on using the changeset viewer.