Make WordPress Core


Ignore:
Timestamp:
01/06/2024 12:59:49 PM (14 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 [55859], [56380], [56802], [57115], [57129], [57185].

See #59655.

File:
1 edited

Legend:

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

    r57129 r57244  
    12601260        switch_theme( $old_theme->get_stylesheet() );
    12611261
    1262         $this->assertEquals( $old_root . '/test', $path1, 'The original stylesheet path is not correct' );
    1263         $this->assertEquals( $new_root . '/test', $path2, 'The new stylesheet path is not correct' );
     1262        $this->assertSame( $old_root . '/test', $path1, 'The original stylesheet path is not correct' );
     1263        $this->assertSame( $new_root . '/test', $path2, 'The new stylesheet path is not correct' );
    12641264    }
    12651265
     
    13031303        switch_theme( $old_theme->get_stylesheet() );
    13041304
    1305         $this->assertEquals( $old_root . '/test-parent', $path1, 'The original template path is not correct' );
    1306         $this->assertEquals( $new_root . '/test-parent', $path2, 'The new template path is not correct' );
     1305        $this->assertSame( $old_root . '/test-parent', $path1, 'The original template path is not correct' );
     1306        $this->assertSame( $new_root . '/test-parent', $path2, 'The new template path is not correct' );
    13071307    }
    13081308}
Note: See TracChangeset for help on using the changeset viewer.