mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Tests: Replace some occurrences of assertEquals() with assertSame().
This ensures that not only the return values match the expected results, but also that their type is the same. Props costdev, desrosj. See #55654. git-svn-id: https://develop.svn.wordpress.org/trunk@54402 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2056,9 +2056,9 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
* @ticket 53668
|
||||
*/
|
||||
public function test_wp_get_default_extension_for_mime_type() {
|
||||
$this->assertEquals( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
|
||||
$this->assertSame( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
|
||||
$this->assertNotEquals( 'jpeg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpeg should not be returned as default extension for "image/jpeg"' );
|
||||
$this->assertEquals( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
|
||||
$this->assertSame( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
|
||||
$this->assertFalse( wp_get_default_extension_for_mime_type( 'wibble/wobble' ), 'false not returned for unrecognized mime type' );
|
||||
$this->assertFalse( wp_get_default_extension_for_mime_type( '' ), 'false not returned when empty string as mime type supplied' );
|
||||
$this->assertFalse( wp_get_default_extension_for_mime_type( ' ' ), 'false not returned when empty string as mime type supplied' );
|
||||
@@ -2072,7 +2072,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
*/
|
||||
function test_wp_filesize_with_nonexistent_file() {
|
||||
$file = 'nonexistent/file.jpg';
|
||||
$this->assertEquals( 0, wp_filesize( $file ) );
|
||||
$this->assertSame( 0, wp_filesize( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2082,7 +2082,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
function test_wp_filesize() {
|
||||
$file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
|
||||
|
||||
$this->assertEquals( filesize( $file ), wp_filesize( $file ) );
|
||||
$this->assertSame( filesize( $file ), wp_filesize( $file ) );
|
||||
|
||||
$filter = function() {
|
||||
return 999;
|
||||
@@ -2090,7 +2090,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
|
||||
add_filter( 'wp_filesize', $filter );
|
||||
|
||||
$this->assertEquals( 999, wp_filesize( $file ) );
|
||||
$this->assertSame( 999, wp_filesize( $file ) );
|
||||
|
||||
$pre_filter = function() {
|
||||
return 111;
|
||||
@@ -2098,7 +2098,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
|
||||
add_filter( 'pre_wp_filesize', $pre_filter );
|
||||
|
||||
$this->assertEquals( 111, wp_filesize( $file ) );
|
||||
$this->assertSame( 111, wp_filesize( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2184,7 +2184,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
),
|
||||
'version' => 1,
|
||||
);
|
||||
$this->assertEquals( $theme_json, $expected_theme_json );
|
||||
$this->assertSameSetsWithIndex( $theme_json, $expected_theme_json );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user