Make WordPress Core


Ignore:
Timestamp:
06/28/2024 03:45:08 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in WP_Interactivity_API 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 [57563], [57649], [57822], [57826], [57835], [58159], [58327].

See #61530.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-router-region.php

    r57836 r58594  
    8989        $new_html = $this->interactivity->process_directives( $html );
    9090        $footer   = $this->render_wp_footer();
    91         $this->assertEquals( $html, $new_html );
    92         $this->assertEquals( '', $footer );
    93         $this->assertEquals( '', get_echo( 'wp_print_styles' ) );
     91        $this->assertSame( $html, $new_html );
     92        $this->assertSame( '', $footer );
     93        $this->assertSame( '', get_echo( 'wp_print_styles' ) );
    9494    }
    9595
     
    109109        ';
    110110        $new_html = $this->interactivity->process_directives( $html );
    111         $this->assertEquals( $html, $new_html );
     111        $this->assertSame( $html, $new_html );
    112112
    113113        // Check that the style is loaded, but only once.
     
    116116        $p      = new WP_HTML_Tag_Processor( $styles );
    117117        $this->assertTrue( $p->next_tag( $query ) );
    118         $this->assertEquals( 'wp-interactivity-router-animations-inline-css', $p->get_attribute( 'id' ) );
     118        $this->assertSame( 'wp-interactivity-router-animations-inline-css', $p->get_attribute( 'id' ) );
    119119        $this->assertStringContainsString( '.wp-interactivity-router-loading-bar', $styles );
    120120        $this->assertFalse( $p->next_tag( $query ) );
Note: See TracChangeset for help on using the changeset viewer.