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.

git-svn-id: https://develop.svn.wordpress.org/trunk@51079 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-06-07 11:16:29 +00:00
parent b61653f944
commit 37a4faa7ed
10 changed files with 137 additions and 137 deletions
+4 -4
View File
@@ -54,7 +54,7 @@ class Block_Template_Test extends WP_UnitTestCase {
'page.php',
);
$resolved_template_path = locate_block_template( $custom_page_template_path, $type, $templates );
$this->assertEquals( $custom_page_template_path, $resolved_template_path );
$this->assertSame( $custom_page_template_path, $resolved_template_path );
}
/**
@@ -73,8 +73,8 @@ class Block_Template_Test extends WP_UnitTestCase {
'page.php',
);
$resolved_template_path = locate_block_template( $page_template_path, $type, $templates );
$this->assertEquals( self::$template_canvas_path, $resolved_template_path );
$this->assertEquals( self::$post->post_content, $_wp_current_template_content );
$this->assertSame( self::$template_canvas_path, $resolved_template_path );
$this->assertSame( self::$post->post_content, $_wp_current_template_content );
}
/**
@@ -82,6 +82,6 @@ class Block_Template_Test extends WP_UnitTestCase {
*/
function test_template_remains_unchanged_if_templates_array_is_empty() {
$resolved_template_path = locate_block_template( '', 'search', array() );
$this->assertEquals( '', $resolved_template_path );
$this->assertSame( '', $resolved_template_path );
}
}