Make WordPress Core


Ignore:
Timestamp:
01/06/2024 12:59:49 PM (13 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/html-api/wpHtmlProcessorSemanticRules.php

    r57186 r57244  
    3636        }
    3737
    38         $this->assertEquals(
     38        $this->assertSame(
    3939            $tag_name,
    4040            $processor->get_tag(),
     
    126126
    127127        $p->step();
    128         $this->assertEquals( 'DIV', $p->get_tag(), 'Did not stop at initial DIV tag.' );
     128        $this->assertSame( 'DIV', $p->get_tag(), 'Did not stop at initial DIV tag.' );
    129129        $this->assertFalse( $p->is_tag_closer(), 'Did not find that initial DIV tag is an opener.' );
    130130
     
    134134         */
    135135        $this->assertTrue( $p->step(), 'Found no further tags when it should have found the closing DIV' );
    136         $this->assertEquals( 'DIV', $p->get_tag(), "Did not skip unexpected BUTTON; stopped at {$p->get_tag()}." );
     136        $this->assertSame( 'DIV', $p->get_tag(), "Did not skip unexpected BUTTON; stopped at {$p->get_tag()}." );
    137137        $this->assertTrue( $p->is_tag_closer(), 'Did not find that the terminal DIV tag is a closer.' );
    138138    }
Note: See TracChangeset for help on using the changeset viewer.