Make WordPress Core


Ignore:
Timestamp:
06/07/2021 11:16:29 AM (5 years 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 [50380], [50959], [50960], [50973], [50993], [51003], [51051], [51054].

See #52482.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-template.php

    r51003 r51079  
    5555        );
    5656        $resolved_template_path    = locate_block_template( $custom_page_template_path, $type, $templates );
    57         $this->assertEquals( $custom_page_template_path, $resolved_template_path );
     57        $this->assertSame( $custom_page_template_path, $resolved_template_path );
    5858    }
    5959
     
    7474        );
    7575        $resolved_template_path     = locate_block_template( $page_template_path, $type, $templates );
    76         $this->assertEquals( self::$template_canvas_path, $resolved_template_path );
    77         $this->assertEquals( self::$post->post_content, $_wp_current_template_content );
     76        $this->assertSame( self::$template_canvas_path, $resolved_template_path );
     77        $this->assertSame( self::$post->post_content, $_wp_current_template_content );
    7878    }
    7979
     
    8383    function test_template_remains_unchanged_if_templates_array_is_empty() {
    8484        $resolved_template_path = locate_block_template( '', 'search', array() );
    85         $this->assertEquals( '', $resolved_template_path );
     85        $this->assertSame( '', $resolved_template_path );
    8686    }
    8787}
Note: See TracChangeset for help on using the changeset viewer.