Paragraph two.
';
- $this->assertEquals( $expected1, trim( wpautop( $content1 ) ) );
- $this->assertEquals( $expected2, trim( wpautop( $content2 ) ) );
+ $this->assertSame( $expected1, trim( wpautop( $content1 ) ) );
+ $this->assertSame( $expected2, trim( wpautop( $content2 ) ) );
}
/**
@@ -274,7 +274,7 @@ Paragraph two.';
*/
public function test_skip_select_option_elements() {
$str = 'Country: ' . $content . '
';
- $this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) );
+ $this->assertSameIgnoreEOL( $expected, trim( wpautop( $content ) ) );
}
/**
@@ -603,6 +603,6 @@ line 2' . $content . '
';
- $this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) );
+ $this->assertSameIgnoreEOL( $expected, trim( wpautop( $content ) ) );
}
}
diff --git a/tests/phpunit/tests/formatting/BlogInfo.php b/tests/phpunit/tests/formatting/BlogInfo.php
index 15b32fa682..37ce3450fa 100644
--- a/tests/phpunit/tests/formatting/BlogInfo.php
+++ b/tests/phpunit/tests/formatting/BlogInfo.php
@@ -15,7 +15,7 @@ class Tests_Formatting_BlogInfo extends WP_UnitTestCase {
$old_locale = $locale;
$locale = $test_locale;
- $this->assertEquals( $expected, get_bloginfo( 'language' ) );
+ $this->assertSame( $expected, get_bloginfo( 'language' ) );
$locale = $old_locale;
}
@@ -54,16 +54,16 @@ class Tests_Formatting_BlogInfo extends WP_UnitTestCase {
$sanitized_value = sanitize_option( 'blogname', $value );
update_option( 'blogname', $sanitized_value );
- $this->assertEquals( $expected, $sanitized_value );
- $this->assertEquals( $expected, get_bloginfo( 'name' ) );
- $this->assertEquals( $expected, get_bloginfo( 'name', 'display' ) );
+ $this->assertSame( $expected, $sanitized_value );
+ $this->assertSame( $expected, get_bloginfo( 'name' ) );
+ $this->assertSame( $expected, get_bloginfo( 'name', 'display' ) );
$sanitized_value = sanitize_option( 'blogdescription', $value );
update_option( 'blogdescription', $sanitized_value );
- $this->assertEquals( $expected, $sanitized_value );
- $this->assertEquals( $expected, get_bloginfo( 'description' ) );
- $this->assertEquals( $expected, get_bloginfo( 'description', 'display' ) );
+ $this->assertSame( $expected, $sanitized_value );
+ $this->assertSame( $expected, get_bloginfo( 'description' ) );
+ $this->assertSame( $expected, get_bloginfo( 'description', 'display' ) );
}
// Restore old values.
diff --git a/tests/phpunit/tests/formatting/CapitalPDangit.php b/tests/phpunit/tests/formatting/CapitalPDangit.php
index 06aec81b49..70656a66a3 100644
--- a/tests/phpunit/tests/formatting/CapitalPDangit.php
+++ b/tests/phpunit/tests/formatting/CapitalPDangit.php
@@ -7,14 +7,14 @@
class Tests_Formatting_CapitalPDangit extends WP_UnitTestCase {
function test_esc_attr_quotes() {
global $wp_current_filter;
- $this->assertEquals( 'Something about WordPress', capital_P_dangit( 'Something about Wordpress' ) );
- $this->assertEquals( 'Something about (WordPress', capital_P_dangit( 'Something about (Wordpress' ) );
- $this->assertEquals( 'Something about ‘WordPress', capital_P_dangit( 'Something about ‘Wordpress' ) );
- $this->assertEquals( 'Something about “WordPress', capital_P_dangit( 'Something about “Wordpress' ) );
- $this->assertEquals( 'Something about >WordPress', capital_P_dangit( 'Something about >Wordpress' ) );
- $this->assertEquals( 'Wordpress', capital_P_dangit( 'Wordpress' ) );
+ $this->assertSame( 'Something about WordPress', capital_P_dangit( 'Something about Wordpress' ) );
+ $this->assertSame( 'Something about (WordPress', capital_P_dangit( 'Something about (Wordpress' ) );
+ $this->assertSame( 'Something about ‘WordPress', capital_P_dangit( 'Something about ‘Wordpress' ) );
+ $this->assertSame( 'Something about “WordPress', capital_P_dangit( 'Something about “Wordpress' ) );
+ $this->assertSame( 'Something about >WordPress', capital_P_dangit( 'Something about >Wordpress' ) );
+ $this->assertSame( 'Wordpress', capital_P_dangit( 'Wordpress' ) );
$wp_current_filter = array( 'the_title' );
- $this->assertEquals( 'WordPress', capital_P_dangit( 'Wordpress' ) );
+ $this->assertSame( 'WordPress', capital_P_dangit( 'Wordpress' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/CleanPre.php b/tests/phpunit/tests/formatting/CleanPre.php
index c49ad469e9..e5b1d965a1 100644
--- a/tests/phpunit/tests/formatting/CleanPre.php
+++ b/tests/phpunit/tests/formatting/CleanPre.php
@@ -13,13 +13,13 @@ class Tests_Formatting_CleanPre extends WP_UnitTestCase {
$source = 'a b c\n',
);
foreach ( $before as $key => $url ) {
- $this->assertEquals( $expected[ $key ], make_clickable( $url ) );
+ $this->assertSame( $expected[ $key ], make_clickable( $url ) );
}
}
@@ -278,7 +278,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
'Question mark then URL?http://example.com/',
);
foreach ( $before as $key => $url ) {
- $this->assertEquals( $expected[ $key ], make_clickable( $url ) );
+ $this->assertSame( $expected[ $key ], make_clickable( $url ) );
}
}
@@ -302,7 +302,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
'Look at this image!',
);
foreach ( $urls_before as $key => $url ) {
- $this->assertEquals( $urls_expected[ $key ], make_clickable( $url ) );
+ $this->assertSame( $urls_expected[ $key ], make_clickable( $url ) );
}
}
@@ -343,7 +343,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
);
foreach ( $before as $key => $url ) {
- $this->assertEquals( $expected[ $key ], make_clickable( $url ) );
+ $this->assertSame( $expected[ $key ], make_clickable( $url ) );
}
}
@@ -360,7 +360,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
'http://example.com/
',
);
foreach ( $urls_before as $key => $url ) {
- $this->assertEquals( $urls_expected[ $key ], make_clickable( $url ) );
+ $this->assertSame( $urls_expected[ $key ], make_clickable( $url ) );
}
}
@@ -370,7 +370,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
// 'This is already a link www.wordpress.org', // Fails in 3.3.1 too.
);
foreach ( $in as $text ) {
- $this->assertEquals( $text, make_clickable( $text ) );
+ $this->assertSame( $text, make_clickable( $text ) );
}
}
@@ -380,7 +380,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
function test_no_segfault() {
$in = str_repeat( 'http://example.com/2011/03/18/post-title/', 256 );
$out = make_clickable( $in );
- $this->assertEquals( $in, $out );
+ $this->assertSame( $in, $out );
}
/**
@@ -389,7 +389,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
function test_line_break_in_existing_clickable_link() {
$html = "someone@example.com";
- $this->assertEquals( $html, make_clickable( $html ) );
+ $this->assertSame( $html, make_clickable( $html ) );
}
/**
@@ -397,7 +397,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
* @dataProvider data_script_and_style_tags
*/
public function test_dont_link_script_and_style_tags( $tag ) {
- $this->assertEquals( $tag, make_clickable( $tag ) );
+ $this->assertSame( $tag, make_clickable( $tag ) );
}
public function data_script_and_style_tags() {
diff --git a/tests/phpunit/tests/formatting/MapDeep.php b/tests/phpunit/tests/formatting/MapDeep.php
index cacd62cf68..0a291c9769 100644
--- a/tests/phpunit/tests/formatting/MapDeep.php
+++ b/tests/phpunit/tests/formatting/MapDeep.php
@@ -7,11 +7,11 @@
class Tests_Formatting_MapDeep extends WP_UnitTestCase {
public function test_map_deep_with_any_function_over_empty_array_should_return_empty_array() {
- $this->assertEquals( array(), map_deep( array(), array( $this, 'append_baba' ) ) );
+ $this->assertSame( array(), map_deep( array(), array( $this, 'append_baba' ) ) );
}
public function test_map_deep_should_map_each_element_of_array_one_level_deep() {
- $this->assertEquals(
+ $this->assertSame(
array(
'ababa',
'xbaba',
@@ -27,7 +27,7 @@ class Tests_Formatting_MapDeep extends WP_UnitTestCase {
}
public function test_map_deep_should_map_each_element_of_array_two_levels_deep() {
- $this->assertEquals(
+ $this->assertSame(
array(
'ababa',
array(
@@ -67,11 +67,11 @@ class Tests_Formatting_MapDeep extends WP_UnitTestCase {
}
public function test_map_deep_should_apply_the_function_to_a_string() {
- $this->assertEquals( 'xbaba', map_deep( 'x', array( $this, 'append_baba' ) ) );
+ $this->assertSame( 'xbaba', map_deep( 'x', array( $this, 'append_baba' ) ) );
}
public function test_map_deep_should_apply_the_function_to_an_integer() {
- $this->assertEquals( '5baba', map_deep( 5, array( $this, 'append_baba' ) ) );
+ $this->assertSame( '5baba', map_deep( 5, array( $this, 'append_baba' ) ) );
}
public function test_map_deep_should_map_each_property_of_an_object() {
@@ -157,7 +157,7 @@ class Tests_Formatting_MapDeep extends WP_UnitTestCase {
'var0' => &$array_a['var0'],
'var1' => 'x',
);
- $this->assertEquals(
+ $this->assertSame(
array(
'var0' => 'ababa',
'var1' => 'xbaba',
diff --git a/tests/phpunit/tests/formatting/NormalizeWhitespace.php b/tests/phpunit/tests/formatting/NormalizeWhitespace.php
index 9ed6b30ac2..9d963e0ef6 100644
--- a/tests/phpunit/tests/formatting/NormalizeWhitespace.php
+++ b/tests/phpunit/tests/formatting/NormalizeWhitespace.php
@@ -47,6 +47,6 @@ class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase {
* @dataProvider get_input_output
*/
function test_normalize_whitespace( $in_str, $exp_str ) {
- $this->assertEquals( $exp_str, normalize_whitespace( $in_str ) );
+ $this->assertSame( $exp_str, normalize_whitespace( $in_str ) );
}
}
diff --git a/tests/phpunit/tests/formatting/RemoveAccents.php b/tests/phpunit/tests/formatting/RemoveAccents.php
index e68044d8c8..e66b876e02 100644
--- a/tests/phpunit/tests/formatting/RemoveAccents.php
+++ b/tests/phpunit/tests/formatting/RemoveAccents.php
@@ -5,7 +5,7 @@
*/
class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_remove_accents_simple() {
- $this->assertEquals( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
+ $this->assertSame( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
}
/**
@@ -15,23 +15,23 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
$input = 'ªºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ';
$output = 'aoAAAAAAAECEEEEIIIIDNOOOOOOUUUUYTHsaaaaaaaeceeeeiiiidnoooooouuuuythy';
- $this->assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement' );
+ $this->assertSame( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement' );
}
public function test_remove_accents_latin_extended_a() {
$input = 'ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
$output = 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKkkLlLlLlLlLlNnNnNnnNnOoOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
- $this->assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin Extended A' );
+ $this->assertSame( $output, remove_accents( $input ), 'remove_accents replaces Latin Extended A' );
}
public function test_remove_accents_latin_extended_b() {
- $this->assertEquals( 'SsTt', remove_accents( 'ȘșȚț' ), 'remove_accents replaces Latin Extended B' );
+ $this->assertSame( 'SsTt', remove_accents( 'ȘșȚț' ), 'remove_accents replaces Latin Extended B' );
}
public function test_remove_accents_euro_pound_signs() {
- $this->assertEquals( 'E', remove_accents( '€' ), 'remove_accents replaces euro sign' );
- $this->assertEquals( '', remove_accents( '£' ), 'remove_accents replaces pound sign' );
+ $this->assertSame( 'E', remove_accents( '€' ), 'remove_accents replaces euro sign' );
+ $this->assertSame( '', remove_accents( '£' ), 'remove_accents replaces pound sign' );
}
public function test_remove_accents_iso8859() {
@@ -41,7 +41,7 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
$input = trim( $input );
$output = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyyOEoeAEDHTHssaedhth';
- $this->assertEquals( $output, remove_accents( $input ), 'remove_accents from ISO-8859-1 text' );
+ $this->assertSame( $output, remove_accents( $input ), 'remove_accents from ISO-8859-1 text' );
}
/**
@@ -50,17 +50,17 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_remove_accents_vowels_diacritic() {
// Vowels with diacritic.
// Unmarked.
- $this->assertEquals( 'OoUu', remove_accents( 'ƠơƯư' ) );
+ $this->assertSame( 'OoUu', remove_accents( 'ƠơƯư' ) );
// Grave accent.
- $this->assertEquals( 'AaAaEeOoOoUuYy', remove_accents( 'ẦầẰằỀềỒồỜờỪừỲỳ' ) );
+ $this->assertSame( 'AaAaEeOoOoUuYy', remove_accents( 'ẦầẰằỀềỒồỜờỪừỲỳ' ) );
// Hook.
- $this->assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẢảẨẩẲẳẺẻỂểỈỉỎỏỔổỞởỦủỬửỶỷ' ) );
+ $this->assertSame( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẢảẨẩẲẳẺẻỂểỈỉỎỏỔổỞởỦủỬửỶỷ' ) );
// Tilde.
- $this->assertEquals( 'AaAaEeEeOoOoUuYy', remove_accents( 'ẪẫẴẵẼẽỄễỖỗỠỡỮữỸỹ' ) );
+ $this->assertSame( 'AaAaEeEeOoOoUuYy', remove_accents( 'ẪẫẴẵẼẽỄễỖỗỠỡỮữỸỹ' ) );
// Acute accent.
- $this->assertEquals( 'AaAaEeOoOoUu', remove_accents( 'ẤấẮắẾếỐốỚớỨứ' ) );
+ $this->assertSame( 'AaAaEeOoOoUu', remove_accents( 'ẤấẮắẾếỐốỚớỨứ' ) );
// Dot below.
- $this->assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẠạẬậẶặẸẹỆệỊịỌọỘộỢợỤụỰựỴỵ' ) );
+ $this->assertSame( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẠạẬậẶặẸẹỆệỊịỌọỘộỢợỤụỰựỴỵ' ) );
}
/**
@@ -69,15 +69,15 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_remove_accents_hanyu_pinyin() {
// Vowels with diacritic (Chinese, Hanyu Pinyin).
// Macron.
- $this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'āēīōūǖĀĒĪŌŪǕ' ) );
+ $this->assertSame( 'aeiouuAEIOUU', remove_accents( 'āēīōūǖĀĒĪŌŪǕ' ) );
// Acute accent.
- $this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'áéíóúǘÁÉÍÓÚǗ' ) );
+ $this->assertSame( 'aeiouuAEIOUU', remove_accents( 'áéíóúǘÁÉÍÓÚǗ' ) );
// Caron.
- $this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'ǎěǐǒǔǚǍĚǏǑǓǙ' ) );
+ $this->assertSame( 'aeiouuAEIOUU', remove_accents( 'ǎěǐǒǔǚǍĚǏǑǓǙ' ) );
// Grave accent.
- $this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'àèìòùǜÀÈÌÒÙǛ' ) );
+ $this->assertSame( 'aeiouuAEIOUU', remove_accents( 'àèìòùǜÀÈÌÒÙǛ' ) );
// Unmarked.
- $this->assertEquals( 'aaeiouuAEIOUU', remove_accents( 'aɑeiouüAEIOUÜ' ) );
+ $this->assertSame( 'aaeiouuAEIOUU', remove_accents( 'aɑeiouüAEIOUÜ' ) );
}
function _remove_accents_germanic_umlauts_cb() {
@@ -90,7 +90,7 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_remove_accents_germanic_umlauts() {
add_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
- $this->assertEquals( 'AeOeUeaeoeuess', remove_accents( 'ÄÖÜäöüß' ) );
+ $this->assertSame( 'AeOeUeaeoeuess', remove_accents( 'ÄÖÜäöüß' ) );
remove_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
}
@@ -105,7 +105,7 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_remove_danish_accents() {
add_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
- $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
+ $this->assertSame( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
}
@@ -120,11 +120,11 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_remove_catalan_middot() {
add_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
- $this->assertEquals( 'allallalla', remove_accents( 'al·lallaŀla' ) );
+ $this->assertSame( 'allallalla', remove_accents( 'al·lallaŀla' ) );
remove_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
- $this->assertEquals( 'al·lallalla', remove_accents( 'al·lallaŀla' ) );
+ $this->assertSame( 'al·lallalla', remove_accents( 'al·lallaŀla' ) );
}
public function _set_locale_to_serbian() {
@@ -137,10 +137,10 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
public function test_transcribe_serbian_crossed_d() {
add_filter( 'locale', array( $this, '_set_locale_to_serbian' ) );
- $this->assertEquals( 'DJdj', remove_accents( 'Đđ' ) );
+ $this->assertSame( 'DJdj', remove_accents( 'Đđ' ) );
remove_filter( 'locale', array( $this, '_set_locale_to_serbian' ) );
- $this->assertEquals( 'Dd', remove_accents( 'Đđ' ) );
+ $this->assertSame( 'Dd', remove_accents( 'Đđ' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/SanitizeFileName.php b/tests/phpunit/tests/formatting/SanitizeFileName.php
index 3e01469329..39057aad06 100644
--- a/tests/phpunit/tests/formatting/SanitizeFileName.php
+++ b/tests/phpunit/tests/formatting/SanitizeFileName.php
@@ -7,7 +7,7 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
function test_munges_extensions() {
# r17990
$file_name = sanitize_file_name( 'test.phtml.txt' );
- $this->assertEquals( 'test.phtml_.txt', $file_name );
+ $this->assertSame( 'test.phtml_.txt', $file_name );
}
function test_removes_special_chars() {
@@ -17,7 +17,7 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
$string .= $char;
}
$string .= 'test';
- $this->assertEquals( 'testtest', sanitize_file_name( $string ) );
+ $this->assertSame( 'testtest', sanitize_file_name( $string ) );
}
/**
@@ -26,7 +26,7 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
function test_removes_accents() {
$in = 'àáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ';
$out = 'aaaaaaaeceeeeiiiinoooooouuuuyy';
- $this->assertEquals( $out, sanitize_file_name( $in ) );
+ $this->assertSame( $out, sanitize_file_name( $in ) );
}
/**
@@ -43,46 +43,46 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
);
foreach ( $urls as $test => $expected ) {
- $this->assertEquals( $expected, sanitize_file_name( $test ) );
+ $this->assertSame( $expected, sanitize_file_name( $test ) );
}
}
function test_replaces_any_number_of_hyphens_with_one_hyphen() {
- $this->assertEquals( 'a-t-t', sanitize_file_name( 'a----t----t' ) );
+ $this->assertSame( 'a-t-t', sanitize_file_name( 'a----t----t' ) );
}
function test_trims_trailing_hyphens() {
- $this->assertEquals( 'a-t-t', sanitize_file_name( 'a----t----t----' ) );
+ $this->assertSame( 'a-t-t', sanitize_file_name( 'a----t----t----' ) );
}
function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
- $this->assertEquals( 'a-t', sanitize_file_name( 'a t' ) );
- $this->assertEquals( 'a-t', sanitize_file_name( "a \n\n\nt" ) );
+ $this->assertSame( 'a-t', sanitize_file_name( 'a t' ) );
+ $this->assertSame( 'a-t', sanitize_file_name( "a \n\n\nt" ) );
}
/**
* @ticket 16226
*/
function test_replaces_percent_sign() {
- $this->assertEquals( 'a22b.jpg', sanitize_file_name( 'a%22b.jpg' ) );
+ $this->assertSame( 'a22b.jpg', sanitize_file_name( 'a%22b.jpg' ) );
}
function test_replaces_unnamed_file_extensions() {
// Test filenames with both supported and unsupported extensions.
- $this->assertEquals( 'unnamed-file.exe', sanitize_file_name( '_.exe' ) );
- $this->assertEquals( 'unnamed-file.jpg', sanitize_file_name( '_.jpg' ) );
+ $this->assertSame( 'unnamed-file.exe', sanitize_file_name( '_.exe' ) );
+ $this->assertSame( 'unnamed-file.jpg', sanitize_file_name( '_.jpg' ) );
}
function test_replaces_unnamed_file_extensionless() {
// Test a filenames that becomes extensionless.
- $this->assertEquals( 'no-extension', sanitize_file_name( '_.no-extension' ) );
+ $this->assertSame( 'no-extension', sanitize_file_name( '_.no-extension' ) );
}
/**
* @dataProvider data_wp_filenames
*/
function test_replaces_invalid_utf8_characters( $input, $expected ) {
- $this->assertEquals( $expected, sanitize_file_name( $input ) );
+ $this->assertSame( $expected, sanitize_file_name( $input ) );
}
function data_wp_filenames() {
diff --git a/tests/phpunit/tests/formatting/SanitizeMimeType.php b/tests/phpunit/tests/formatting/SanitizeMimeType.php
index e8475ff6cf..45c8ec611f 100644
--- a/tests/phpunit/tests/formatting/SanitizeMimeType.php
+++ b/tests/phpunit/tests/formatting/SanitizeMimeType.php
@@ -35,7 +35,7 @@ class Tests_Formatting_SanitizeMimeType extends WP_UnitTestCase {
);
foreach ( $inputs as $input ) {
- $this->assertEquals( $input, sanitize_mime_type( $input ) );
+ $this->assertSame( $input, sanitize_mime_type( $input ) );
}
}
}
diff --git a/tests/phpunit/tests/formatting/SanitizeOrderby.php b/tests/phpunit/tests/formatting/SanitizeOrderby.php
index 371d63b52e..95d2bed15e 100644
--- a/tests/phpunit/tests/formatting/SanitizeOrderby.php
+++ b/tests/phpunit/tests/formatting/SanitizeOrderby.php
@@ -10,7 +10,7 @@ class Tests_Formatting_SanitizeOrderby extends WP_UnitTestCase {
* @dataProvider valid_orderbys
*/
function test_valid( $orderby ) {
- $this->assertEquals( $orderby, sanitize_sql_orderby( $orderby ) );
+ $this->assertSame( $orderby, sanitize_sql_orderby( $orderby ) );
}
function valid_orderbys() {
return array(
diff --git a/tests/phpunit/tests/formatting/SanitizeTextField.php b/tests/phpunit/tests/formatting/SanitizeTextField.php
index 441f52491b..00c19faa17 100644
--- a/tests/phpunit/tests/formatting/SanitizeTextField.php
+++ b/tests/phpunit/tests/formatting/SanitizeTextField.php
@@ -136,8 +136,8 @@ class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
$expected_oneline = $expected;
$expected_multiline = $expected;
}
- $this->assertEquals( $expected_oneline, sanitize_text_field( $string ) );
- $this->assertEqualsIgnoreEOL( $expected_multiline, sanitize_textarea_field( $string ) );
+ $this->assertSame( $expected_oneline, sanitize_text_field( $string ) );
+ $this->assertSameIgnoreEOL( $expected_multiline, sanitize_textarea_field( $string ) );
}
}
diff --git a/tests/phpunit/tests/formatting/SanitizeTitle.php b/tests/phpunit/tests/formatting/SanitizeTitle.php
index e536e14b40..a389d580ba 100644
--- a/tests/phpunit/tests/formatting/SanitizeTitle.php
+++ b/tests/phpunit/tests/formatting/SanitizeTitle.php
@@ -7,12 +7,12 @@ class Tests_Formatting_SanitizeTitle extends WP_UnitTestCase {
function test_strips_html() {
$input = 'Captain Awesome';
$expected = 'captain-awesome';
- $this->assertEquals( $expected, sanitize_title( $input ) );
+ $this->assertSame( $expected, sanitize_title( $input ) );
}
function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
$input = '';
$fallback = 'Captain Awesome';
- $this->assertEquals( $fallback, sanitize_title( $input, $fallback ) );
+ $this->assertSame( $fallback, sanitize_title( $input, $fallback ) );
}
}
diff --git a/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php b/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
index 4fcce5bb39..e105afca15 100644
--- a/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
+++ b/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
@@ -7,144 +7,144 @@ class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase {
function test_strips_html() {
$input = 'Captain Awesome';
$expected = 'captain-awesome';
- $this->assertEquals( $expected, sanitize_title( $input ) );
+ $this->assertSame( $expected, sanitize_title( $input ) );
}
function test_strips_unencoded_percent_signs() {
- $this->assertEquals( 'fran%c3%a7ois', sanitize_title_with_dashes( 'fran%c3%a7%ois' ) );
+ $this->assertSame( 'fran%c3%a7ois', sanitize_title_with_dashes( 'fran%c3%a7%ois' ) );
}
function test_makes_title_lowercase() {
- $this->assertEquals( 'abc', sanitize_title_with_dashes( 'ABC' ) );
+ $this->assertSame( 'abc', sanitize_title_with_dashes( 'ABC' ) );
}
function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
- $this->assertEquals( 'a-t', sanitize_title_with_dashes( 'a t' ) );
- $this->assertEquals( 'a-t', sanitize_title_with_dashes( "a \n\n\nt" ) );
+ $this->assertSame( 'a-t', sanitize_title_with_dashes( 'a t' ) );
+ $this->assertSame( 'a-t', sanitize_title_with_dashes( "a \n\n\nt" ) );
}
function test_replaces_any_number_of_hyphens_with_one_hyphen() {
- $this->assertEquals( 'a-t-t', sanitize_title_with_dashes( 'a----t----t' ) );
+ $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t' ) );
}
function test_trims_trailing_hyphens() {
- $this->assertEquals( 'a-t-t', sanitize_title_with_dashes( 'a----t----t----' ) );
+ $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t----' ) );
}
function test_handles_non_entity_ampersands() {
- $this->assertEquals( 'penn-teller-bull', sanitize_title_with_dashes( 'penn & teller bull' ) );
+ $this->assertSame( 'penn-teller-bull', sanitize_title_with_dashes( 'penn & teller bull' ) );
}
public function test_strips_nbsp_ndash_and_amp() {
- $this->assertEquals( 'no-entities-here', sanitize_title_with_dashes( 'No Entities – Here &' ) );
+ $this->assertSame( 'no-entities-here', sanitize_title_with_dashes( 'No Entities – Here &' ) );
}
public function test_strips_encoded_ampersand() {
- $this->assertEquals( 'one-two', sanitize_title_with_dashes( 'One & Two', '', 'save' ) );
+ $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One & Two', '', 'save' ) );
}
public function test_strips_url_encoded_ampersand() {
- $this->assertEquals( 'one-two', sanitize_title_with_dashes( 'One { Two;', '', 'save' ) );
+ $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One { Two;', '', 'save' ) );
}
public function test_strips_trademark_symbol() {
- $this->assertEquals( 'one-two', sanitize_title_with_dashes( 'One Two™;', '', 'save' ) );
+ $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One Two™;', '', 'save' ) );
}
public function test_strips_unencoded_ampersand_followed_by_encoded_ampersand() {
- $this->assertEquals( 'one-two', sanitize_title_with_dashes( 'One && Two;', '', 'save' ) );
+ $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One && Two;', '', 'save' ) );
}
public function test_strips_unencoded_ampersand_when_not_surrounded_by_spaces() {
- $this->assertEquals( 'onetwo', sanitize_title_with_dashes( 'One&Two', '', 'save' ) );
+ $this->assertSame( 'onetwo', sanitize_title_with_dashes( 'One&Two', '', 'save' ) );
}
function test_replaces_nbsp() {
- $this->assertEquals( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );
+ $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );
}
/**
* @ticket 31790
*/
function test_replaces_nbsp_entities() {
- $this->assertEquals( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );
+ $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );
}
function test_replaces_ndash_mdash() {
- $this->assertEquals( 'do-the-dash', sanitize_title_with_dashes( 'Do – the Dash', '', 'save' ) );
- $this->assertEquals( 'do-the-dash', sanitize_title_with_dashes( 'Do the — Dash', '', 'save' ) );
+ $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the Dash', '', 'save' ) );
+ $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do the — Dash', '', 'save' ) );
}
/**
* @ticket 31790
*/
function test_replaces_ndash_mdash_entities() {
- $this->assertEquals( 'do-the-dash', sanitize_title_with_dashes( 'Do – the – Dash', '', 'save' ) );
- $this->assertEquals( 'do-the-dash', sanitize_title_with_dashes( 'Do — the — Dash', '', 'save' ) );
+ $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the – Dash', '', 'save' ) );
+ $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do — the — Dash', '', 'save' ) );
}
function test_replaces_iexcel_iquest() {
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just ¡a Slug', '', 'save' ) );
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just a Slug¿', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just ¡a Slug', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just a Slug¿', '', 'save' ) );
}
function test_replaces_angle_quotes() {
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( '‹Just a Slug›', '', 'save' ) );
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( '«Just a Slug»', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '‹Just a Slug›', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '«Just a Slug»', '', 'save' ) );
}
function test_replaces_curly_quotes() {
- $this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its “Curly Joe”', '', 'save' ) );
- $this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‘Curly Joe’', '', 'save' ) );
- $this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe“', '', 'save' ) );
- $this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‚Curly Joe‛', '', 'save' ) );
- $this->assertEquals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe‟', '', 'save' ) );
+ $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its “Curly Joe”', '', 'save' ) );
+ $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‘Curly Joe’', '', 'save' ) );
+ $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe“', '', 'save' ) );
+ $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‚Curly Joe‛', '', 'save' ) );
+ $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe‟', '', 'save' ) );
}
/**
* @ticket 49791
*/
function test_replaces_bullet() {
- $this->assertEquals( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) );
+ $this->assertSame( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) );
}
function test_replaces_copy_reg_deg_trade() {
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) );
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) );
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just a ° Slug', '', 'save' ) );
- $this->assertEquals( 'just-a-slug', sanitize_title_with_dashes( 'Just ™ a Slug', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just a ° Slug', '', 'save' ) );
+ $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just ™ a Slug', '', 'save' ) );
}
/**
* @ticket 10792
*/
function test_replaces_forward_slash() {
- $this->assertEquals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/McCartney', '', 'save' ) );
- $this->assertEquals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon//McCartney', '', 'save' ) );
- $this->assertEquals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon///McCartney', '', 'save' ) );
- $this->assertEquals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/-McCartney', '', 'save' ) );
- $this->assertEquals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( '//songs by Lennon/McCartney', '', 'save' ) );
+ $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/McCartney', '', 'save' ) );
+ $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon//McCartney', '', 'save' ) );
+ $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon///McCartney', '', 'save' ) );
+ $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/-McCartney', '', 'save' ) );
+ $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( '//songs by Lennon/McCartney', '', 'save' ) );
}
/**
* @ticket 19820
*/
function test_replaces_multiply_sign() {
- $this->assertEquals( '6x7-is-42', sanitize_title_with_dashes( '6×7 is 42', '', 'save' ) );
+ $this->assertSame( '6x7-is-42', sanitize_title_with_dashes( '6×7 is 42', '', 'save' ) );
}
/**
* @ticket 20772
*/
function test_replaces_standalone_diacritic() {
- $this->assertEquals( 'aaaa', sanitize_title_with_dashes( 'āáǎà', '', 'save' ) );
+ $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'āáǎà', '', 'save' ) );
}
/**
* @ticket 22395
*/
function test_replaces_acute_accents() {
- $this->assertEquals( 'aaaa', sanitize_title_with_dashes( 'ááa´aˊ', '', 'save' ) );
+ $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'ááa´aˊ', '', 'save' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php b/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php
index b70f71bb43..d790cdcc16 100644
--- a/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php
+++ b/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php
@@ -9,7 +9,7 @@ class Tests_Formatting_SanitizeTrackbackUrls extends WP_UnitTestCase {
* @dataProvider breaks
*/
function test_sanitize_trackback_urls_with_multiple_urls( $break ) {
- $this->assertEquals( "http://example.com\nhttp://example.org", sanitize_trackback_urls( "http://example.com{$break}http://example.org" ) );
+ $this->assertSame( "http://example.com\nhttp://example.org", sanitize_trackback_urls( "http://example.com{$break}http://example.org" ) );
}
function breaks() {
diff --git a/tests/phpunit/tests/formatting/SanitizeUser.php b/tests/phpunit/tests/formatting/SanitizeUser.php
index b4e051c678..43533c6642 100644
--- a/tests/phpunit/tests/formatting/SanitizeUser.php
+++ b/tests/phpunit/tests/formatting/SanitizeUser.php
@@ -7,7 +7,7 @@ class Tests_Formatting_SanitizeUser extends WP_UnitTestCase {
function test_strips_html() {
$input = 'Captain Awesome';
$expected = is_multisite() ? 'captain awesome' : 'Captain Awesome';
- $this->assertEquals( $expected, sanitize_user( $input ) );
+ $this->assertSame( $expected, sanitize_user( $input ) );
}
public function test_strips_encoded_ampersand() {
@@ -18,7 +18,7 @@ class Tests_Formatting_SanitizeUser extends WP_UnitTestCase {
$expected = strtolower( $expected );
}
- $this->assertEquals( $expected, sanitize_user( 'AT&T' ) );
+ $this->assertSame( $expected, sanitize_user( 'AT&T' ) );
}
public function test_strips_encoded_ampersand_when_followed_by_semicolon() {
@@ -29,14 +29,14 @@ class Tests_Formatting_SanitizeUser extends WP_UnitTestCase {
$expected = strtolower( $expected );
}
- $this->assertEquals( $expected, sanitize_user( 'AT&T Test;' ) );
+ $this->assertSame( $expected, sanitize_user( 'AT&T Test;' ) );
}
function test_strips_percent_encoded_octets() {
$expected = is_multisite() ? 'franois' : 'Franois';
- $this->assertEquals( $expected, sanitize_user( 'Fran%c3%a7ois' ) );
+ $this->assertSame( $expected, sanitize_user( 'Fran%c3%a7ois' ) );
}
function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
- $this->assertEquals( 'abc', sanitize_user( '()~ab~ˆcˆ!', true ) );
+ $this->assertSame( 'abc', sanitize_user( '()~ab~ˆcˆ!', true ) );
}
}
diff --git a/tests/phpunit/tests/formatting/Slashit.php b/tests/phpunit/tests/formatting/Slashit.php
index 876d7fda22..9f25694405 100644
--- a/tests/phpunit/tests/formatting/Slashit.php
+++ b/tests/phpunit/tests/formatting/Slashit.php
@@ -5,50 +5,50 @@
*/
class Tests_Formatting_Slashit extends WP_UnitTestCase {
function test_backslashes_middle_numbers() {
- $this->assertEquals( "\\a-!9\\a943\\b\\c", backslashit( 'a-!9a943bc' ) );
+ $this->assertSame( "\\a-!9\\a943\\b\\c", backslashit( 'a-!9a943bc' ) );
}
function test_backslashes_alphas() {
- $this->assertEquals( "\\a943\\b\\c", backslashit( 'a943bc' ) );
+ $this->assertSame( "\\a943\\b\\c", backslashit( 'a943bc' ) );
}
function test_double_backslashes_leading_numbers() {
- $this->assertEquals( '\\\\95', backslashit( '95' ) );
+ $this->assertSame( '\\\\95', backslashit( '95' ) );
}
function test_removes_trailing_slashes() {
- $this->assertEquals( 'a', untrailingslashit( 'a/' ) );
- $this->assertEquals( 'a', untrailingslashit( 'a////' ) );
+ $this->assertSame( 'a', untrailingslashit( 'a/' ) );
+ $this->assertSame( 'a', untrailingslashit( 'a////' ) );
}
/**
* @ticket 22267
*/
function test_removes_trailing_backslashes() {
- $this->assertEquals( 'a', untrailingslashit( 'a\\' ) );
- $this->assertEquals( 'a', untrailingslashit( 'a\\\\\\\\' ) );
+ $this->assertSame( 'a', untrailingslashit( 'a\\' ) );
+ $this->assertSame( 'a', untrailingslashit( 'a\\\\\\\\' ) );
}
/**
* @ticket 22267
*/
function test_removes_trailing_mixed_slashes() {
- $this->assertEquals( 'a', untrailingslashit( 'a/\\' ) );
- $this->assertEquals( 'a', untrailingslashit( 'a\\/\\///\\\\//' ) );
+ $this->assertSame( 'a', untrailingslashit( 'a/\\' ) );
+ $this->assertSame( 'a', untrailingslashit( 'a\\/\\///\\\\//' ) );
}
function test_adds_trailing_slash() {
- $this->assertEquals( 'a/', trailingslashit( 'a' ) );
+ $this->assertSame( 'a/', trailingslashit( 'a' ) );
}
function test_does_not_add_trailing_slash_if_one_exists() {
- $this->assertEquals( 'a/', trailingslashit( 'a/' ) );
+ $this->assertSame( 'a/', trailingslashit( 'a/' ) );
}
/**
* @ticket 22267
*/
function test_converts_trailing_backslash_to_slash_if_one_exists() {
- $this->assertEquals( 'a/', trailingslashit( 'a\\' ) );
+ $this->assertSame( 'a/', trailingslashit( 'a\\' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/Smilies.php b/tests/phpunit/tests/formatting/Smilies.php
index 29d6b7dfa9..f5394d4268 100644
--- a/tests/phpunit/tests/formatting/Smilies.php
+++ b/tests/phpunit/tests/formatting/Smilies.php
@@ -54,12 +54,12 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
smilies_init();
- $this->assertEquals( $converted_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $converted_txt, convert_smilies( $in_txt ) );
// Standard smilies, use_smilies: OFF.
update_option( 'use_smilies', 0 );
- $this->assertEquals( $in_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $in_txt, convert_smilies( $in_txt ) );
}
/**
@@ -112,12 +112,12 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
smilies_init();
- $this->assertEquals( $converted_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $converted_txt, convert_smilies( $in_txt ) );
// Standard smilies, use_smilies: OFF.
update_option( 'use_smilies', 0 );
- $this->assertEquals( $in_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $in_txt, convert_smilies( $in_txt ) );
$wpsmiliestrans = $trans_orig; // Reset original translations array.
}
@@ -153,7 +153,7 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
update_option( 'use_smilies', 1 );
smilies_init();
- $this->assertEquals( $exp_str, convert_smilies( $in_str ) );
+ $this->assertSame( $exp_str, convert_smilies( $in_str ) );
// Standard smilies, use_smilies: OFF.
update_option( 'use_smilies', 0 );
@@ -205,12 +205,12 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
update_option( 'use_smilies', 1 );
smilies_init();
- $this->assertEquals( $converted_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $converted_txt, convert_smilies( $in_txt ) );
// Custom smilies, use_smilies: OFF.
update_option( 'use_smilies', 0 );
- $this->assertEquals( $in_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $in_txt, convert_smilies( $in_txt ) );
}
/**
@@ -260,12 +260,12 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
smilies_init();
- $this->assertEquals( $converted_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $converted_txt, convert_smilies( $in_txt ) );
// Standard smilies, use_smilies: OFF.
update_option( 'use_smilies', 0 );
- $this->assertEquals( $in_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $in_txt, convert_smilies( $in_txt ) );
$wpsmiliestrans = $orig_trans; // Reset original translations array.
}
@@ -305,7 +305,7 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
smilies_init();
- $this->assertEquals( $converted_txt, convert_smilies( $in_txt ) );
+ $this->assertSame( $converted_txt, convert_smilies( $in_txt ) );
// Standard smilies, use_smilies: OFF.
update_option( 'use_smilies', 0 );
@@ -323,7 +323,7 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
$txt = ':oops: I did it again';
- $this->assertEquals( $txt, convert_smilies( $txt ) );
+ $this->assertSame( $txt, convert_smilies( $txt ) );
}
/**
@@ -339,7 +339,7 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
$txt = 'You played with my <3';
$expected_txt = 'You played with my \xe2\x9d\xa4';
- $this->assertEquals( $expected_txt, convert_smilies( $txt ) );
+ $this->assertSame( $expected_txt, convert_smilies( $txt ) );
}
diff --git a/tests/phpunit/tests/formatting/StripSlashesDeep.php b/tests/phpunit/tests/formatting/StripSlashesDeep.php
index b27f6422e7..a401a99f79 100644
--- a/tests/phpunit/tests/formatting/StripSlashesDeep.php
+++ b/tests/phpunit/tests/formatting/StripSlashesDeep.php
@@ -10,10 +10,10 @@ class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
*/
function test_preserves_original_datatype() {
- $this->assertEquals( true, stripslashes_deep( true ) );
- $this->assertEquals( false, stripslashes_deep( false ) );
- $this->assertEquals( 4, stripslashes_deep( 4 ) );
- $this->assertEquals( 'foo', stripslashes_deep( 'foo' ) );
+ $this->assertTrue( stripslashes_deep( true ) );
+ $this->assertFalse( stripslashes_deep( false ) );
+ $this->assertSame( 4, stripslashes_deep( 4 ) );
+ $this->assertSame( 'foo', stripslashes_deep( 'foo' ) );
$arr = array(
'a' => true,
'b' => false,
@@ -21,23 +21,23 @@ class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
'd' => 'foo',
);
$arr['e'] = $arr; // Add a sub-array.
- $this->assertEquals( $arr, stripslashes_deep( $arr ) ); // Keyed array.
- $this->assertEquals( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed.
+ $this->assertSame( $arr, stripslashes_deep( $arr ) ); // Keyed array.
+ $this->assertSame( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed.
$obj = new stdClass;
foreach ( $arr as $k => $v ) {
$obj->$k = $v;
}
- $this->assertEquals( $obj, stripslashes_deep( $obj ) );
+ $this->assertSame( $obj, stripslashes_deep( $obj ) );
}
function test_strips_slashes() {
$old = "I can\'t see, isn\'t that it?";
$new = "I can't see, isn't that it?";
- $this->assertEquals( $new, stripslashes_deep( $old ) );
- $this->assertEquals( $new, stripslashes_deep( "I can\\'t see, isn\\'t that it?" ) );
- $this->assertEquals( array( 'a' => $new ), stripslashes_deep( array( 'a' => $old ) ) ); // Keyed array.
- $this->assertEquals( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed.
+ $this->assertSame( $new, stripslashes_deep( $old ) );
+ $this->assertSame( $new, stripslashes_deep( "I can\\'t see, isn\\'t that it?" ) );
+ $this->assertSame( array( 'a' => $new ), stripslashes_deep( array( 'a' => $old ) ) ); // Keyed array.
+ $this->assertSame( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed.
$obj_old = new stdClass;
$obj_old->a = $old;
@@ -48,7 +48,7 @@ class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
function test_permits_escaped_slash() {
$txt = "I can't see, isn\'t that it?";
- $this->assertEquals( $txt, stripslashes_deep( "I can\'t see, isn\\\'t that it?" ) );
- $this->assertEquals( $txt, stripslashes_deep( "I can\'t see, isn\\\\\'t that it?" ) );
+ $this->assertSame( $txt, stripslashes_deep( "I can\'t see, isn\\\'t that it?" ) );
+ $this->assertSame( $txt, stripslashes_deep( "I can\'t see, isn\\\\\'t that it?" ) );
}
}
diff --git a/tests/phpunit/tests/formatting/URLShorten.php b/tests/phpunit/tests/formatting/URLShorten.php
index dde9ce9655..a1f1942809 100644
--- a/tests/phpunit/tests/formatting/URLShorten.php
+++ b/tests/phpunit/tests/formatting/URLShorten.php
@@ -14,10 +14,10 @@ class Tests_Formatting_URLShorten extends WP_UnitTestCase {
'http://wordpress.org/about/philosophy/#decisions' => 'wordpress.org/about/philosophy/#…', // Shorten to 32 if > 35 after cleaning.
);
foreach ( $tests as $k => $v ) {
- $this->assertEquals( $v, url_shorten( $k ) );
+ $this->assertSame( $v, url_shorten( $k ) );
}
// Shorten to 31 if > 34 after cleaning.
- $this->assertEquals( 'wordpress.org/about/philosophy/#…', url_shorten( 'http://wordpress.org/about/philosophy/#decisions' ), 31 );
+ $this->assertSame( 'wordpress.org/about/philosophy/#…', url_shorten( 'http://wordpress.org/about/philosophy/#decisions' ), 31 );
}
}
diff --git a/tests/phpunit/tests/formatting/UrlencodeDeep.php b/tests/phpunit/tests/formatting/UrlencodeDeep.php
index 1c36403a19..27c0c750bb 100644
--- a/tests/phpunit/tests/formatting/UrlencodeDeep.php
+++ b/tests/phpunit/tests/formatting/UrlencodeDeep.php
@@ -28,7 +28,7 @@ class Tests_Formatting_UrlencodeDeep extends WP_UnitTestCase {
* @param string $expected
*/
public function test_urlencode_deep_should_encode_individual_value( $actual, $expected ) {
- $this->assertEquals( $expected, urlencode_deep( $actual ) );
+ $this->assertSame( $expected, urlencode_deep( $actual ) );
}
/**
@@ -40,7 +40,7 @@ class Tests_Formatting_UrlencodeDeep extends WP_UnitTestCase {
$actual = wp_list_pluck( $data, 0 );
$expected = wp_list_pluck( $data, 1 );
- $this->assertEquals( $expected, urlencode_deep( $actual ) );
+ $this->assertSame( $expected, urlencode_deep( $actual ) );
}
}
diff --git a/tests/phpunit/tests/formatting/Utf8UriEncode.php b/tests/phpunit/tests/formatting/Utf8UriEncode.php
index 43c925c5fa..a3538e0397 100644
--- a/tests/phpunit/tests/formatting/Utf8UriEncode.php
+++ b/tests/phpunit/tests/formatting/Utf8UriEncode.php
@@ -12,7 +12,7 @@ class Tests_Formatting_Utf8UriEncode extends WP_UnitTestCase {
* @dataProvider data
*/
function test_percent_encodes_non_reserved_characters( $utf8, $urlencoded ) {
- $this->assertEquals( $urlencoded, utf8_uri_encode( $utf8 ) );
+ $this->assertSame( $urlencoded, utf8_uri_encode( $utf8 ) );
}
/**
diff --git a/tests/phpunit/tests/formatting/WPBasename.php b/tests/phpunit/tests/formatting/WPBasename.php
index 780d2c7473..a664e399c0 100644
--- a/tests/phpunit/tests/formatting/WPBasename.php
+++ b/tests/phpunit/tests/formatting/WPBasename.php
@@ -6,14 +6,14 @@
class Tests_Formatting_WP_Basename extends WP_UnitTestCase {
function test_wp_basename_unix() {
- $this->assertEquals(
+ $this->assertSame(
'file',
wp_basename( '/home/test/file' )
);
}
function test_wp_basename_unix_utf8_support() {
- $this->assertEquals(
+ $this->assertSame(
'žluťoučký kůň.txt',
wp_basename( '/test/žluťoučký kůň.txt' )
);
@@ -23,7 +23,7 @@ class Tests_Formatting_WP_Basename extends WP_UnitTestCase {
* @ticket 22138
*/
function test_wp_basename_windows() {
- $this->assertEquals(
+ $this->assertSame(
'file.txt',
wp_basename( 'C:\Documents and Settings\User\file.txt' )
);
@@ -33,7 +33,7 @@ class Tests_Formatting_WP_Basename extends WP_UnitTestCase {
* @ticket 22138
*/
function test_wp_basename_windows_utf8_support() {
- $this->assertEquals(
+ $this->assertSame(
'щипцы.txt',
wp_basename( 'C:\test\щипцы.txt' )
);
diff --git a/tests/phpunit/tests/formatting/WPMakeLinkRelative.php b/tests/phpunit/tests/formatting/WPMakeLinkRelative.php
index 8aee571b91..da6099302b 100644
--- a/tests/phpunit/tests/formatting/WPMakeLinkRelative.php
+++ b/tests/phpunit/tests/formatting/WPMakeLinkRelative.php
@@ -8,13 +8,13 @@ class Tests_Formatting_WPMakeLinkRelative extends WP_UnitTestCase {
public function test_wp_make_link_relative_with_http_scheme() {
$link = 'http://example.com/this-is-a-test-http-url/';
$relative_link = wp_make_link_relative( $link );
- $this->assertEquals( '/this-is-a-test-http-url/', $relative_link );
+ $this->assertSame( '/this-is-a-test-http-url/', $relative_link );
}
public function test_wp_make_link_relative_with_https_scheme() {
$link = 'https://example.com/this-is-a-test-https-url/';
$relative_link = wp_make_link_relative( $link );
- $this->assertEquals( '/this-is-a-test-https-url/', $relative_link );
+ $this->assertSame( '/this-is-a-test-https-url/', $relative_link );
}
/**
@@ -23,7 +23,7 @@ class Tests_Formatting_WPMakeLinkRelative extends WP_UnitTestCase {
public function test_wp_make_link_relative_with_no_scheme() {
$link = '//example.com/this-is-a-test-schemeless-url/';
$relative_link = wp_make_link_relative( $link );
- $this->assertEquals( '/this-is-a-test-schemeless-url/', $relative_link );
+ $this->assertSame( '/this-is-a-test-schemeless-url/', $relative_link );
}
/**
@@ -32,7 +32,7 @@ class Tests_Formatting_WPMakeLinkRelative extends WP_UnitTestCase {
public function test_wp_make_link_relative_should_retain_URL_param_that_is_also_a_URL() {
$link = 'https://example.com/this-is-a-test/?redirect=https://example.org/a-different-test-post/';
$relative_link = wp_make_link_relative( $link );
- $this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link );
+ $this->assertSame( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link );
}
/**
@@ -41,7 +41,7 @@ class Tests_Formatting_WPMakeLinkRelative extends WP_UnitTestCase {
function test_wp_make_link_relative_with_no_path() {
$link = 'http://example.com';
$relative_link = wp_make_link_relative( $link );
- $this->assertEquals( '', $relative_link );
+ $this->assertSame( '', $relative_link );
}
}
diff --git a/tests/phpunit/tests/formatting/WPRelNoFollow.php b/tests/phpunit/tests/formatting/WPRelNoFollow.php
index 187bb5997b..10385cade7 100644
--- a/tests/phpunit/tests/formatting/WPRelNoFollow.php
+++ b/tests/phpunit/tests/formatting/WPRelNoFollow.php
@@ -11,7 +11,7 @@ class Tests_Rel_No_Follow extends WP_UnitTestCase {
public function test_add_no_follow() {
$content = 'This is some cool Code
';
$expected = 'This is some cool Code
';
- $this->assertEquals( $expected, wp_rel_nofollow( $content ) );
+ $this->assertSame( $expected, wp_rel_nofollow( $content ) );
}
/**
@@ -20,7 +20,7 @@ class Tests_Rel_No_Follow extends WP_UnitTestCase {
public function test_convert_no_follow() {
$content = 'This is some cool Code
';
$expected = 'This is some cool Code
';
- $this->assertEquals( $expected, wp_rel_nofollow( $content ) );
+ $this->assertSame( $expected, wp_rel_nofollow( $content ) );
}
/**
@@ -28,7 +28,7 @@ class Tests_Rel_No_Follow extends WP_UnitTestCase {
* @dataProvider data_wp_rel_nofollow
*/
public function test_wp_rel_nofollow( $input, $output ) {
- return $this->assertEquals( wp_slash( $output ), wp_rel_nofollow( $input ) );
+ return $this->assertSame( wp_slash( $output ), wp_rel_nofollow( $input ) );
}
public function data_wp_rel_nofollow() {
@@ -78,6 +78,6 @@ class Tests_Rel_No_Follow extends WP_UnitTestCase {
public function test_append_no_follow_with_valueless_attribute() {
$content = 'This is some cool Code
';
$expected = 'This is some cool Code
';
- $this->assertEquals( $expected, wp_rel_nofollow( $content ) );
+ $this->assertSame( $expected, wp_rel_nofollow( $content ) );
}
}
diff --git a/tests/phpunit/tests/formatting/WPRelUgc.php b/tests/phpunit/tests/formatting/WPRelUgc.php
index 515eebb736..85470155a1 100644
--- a/tests/phpunit/tests/formatting/WPRelUgc.php
+++ b/tests/phpunit/tests/formatting/WPRelUgc.php
@@ -11,7 +11,7 @@ class Tests_Rel_Ugc extends WP_UnitTestCase {
public function test_add_ugc() {
$content = 'This is some cool Code
';
$expected = 'This is some cool Code
';
- $this->assertEquals( $expected, wp_rel_ugc( $content ) );
+ $this->assertSame( $expected, wp_rel_ugc( $content ) );
}
/**
@@ -20,7 +20,7 @@ class Tests_Rel_Ugc extends WP_UnitTestCase {
public function test_convert_ugc() {
$content = 'This is some cool Code
';
$expected = 'This is some cool Code
';
- $this->assertEquals( $expected, wp_rel_ugc( $content ) );
+ $this->assertSame( $expected, wp_rel_ugc( $content ) );
}
/**
@@ -28,7 +28,7 @@ class Tests_Rel_Ugc extends WP_UnitTestCase {
* @dataProvider data_wp_rel_ugc
*/
public function test_wp_rel_ugc( $input, $output ) {
- return $this->assertEquals( wp_slash( $output ), wp_rel_ugc( $input ) );
+ return $this->assertSame( wp_slash( $output ), wp_rel_ugc( $input ) );
}
public function data_wp_rel_ugc() {
@@ -78,6 +78,6 @@ class Tests_Rel_Ugc extends WP_UnitTestCase {
public function test_append_ugc_with_valueless_attribute() {
$content = 'This is some cool Code
';
$expected = 'This is some cool Code
';
- $this->assertEquals( $expected, wp_rel_ugc( $content ) );
+ $this->assertSame( $expected, wp_rel_ugc( $content ) );
}
}
diff --git a/tests/phpunit/tests/formatting/WPSlash.php b/tests/phpunit/tests/formatting/WPSlash.php
index 296dc9c28b..4b0d206c06 100644
--- a/tests/phpunit/tests/formatting/WPSlash.php
+++ b/tests/phpunit/tests/formatting/WPSlash.php
@@ -57,10 +57,10 @@ class Tests_Formatting_WPSlash extends WP_UnitTestCase {
function test_adds_slashes() {
$old = "I can't see, isn't that it?";
$new = "I can\'t see, isn\'t that it?";
- $this->assertEquals( $new, wp_slash( $old ) );
- $this->assertEquals( "I can\\\\\'t see, isn\\\\\'t that it?", wp_slash( $new ) );
- $this->assertEquals( array( 'a' => $new ), wp_slash( array( 'a' => $old ) ) ); // Keyed array.
- $this->assertEquals( array( $new ), wp_slash( array( $old ) ) ); // Non-keyed.
+ $this->assertSame( $new, wp_slash( $old ) );
+ $this->assertSame( "I can\\\\\'t see, isn\\\\\'t that it?", wp_slash( $new ) );
+ $this->assertSame( array( 'a' => $new ), wp_slash( array( 'a' => $old ) ) ); // Keyed array.
+ $this->assertSame( array( $new ), wp_slash( array( $old ) ) ); // Non-keyed.
}
/**
@@ -68,10 +68,10 @@ class Tests_Formatting_WPSlash extends WP_UnitTestCase {
*/
function test_preserves_original_datatype() {
- $this->assertEquals( true, wp_slash( true ) );
- $this->assertEquals( false, wp_slash( false ) );
- $this->assertEquals( 4, wp_slash( 4 ) );
- $this->assertEquals( 'foo', wp_slash( 'foo' ) );
+ $this->assertTrue( wp_slash( true ) );
+ $this->assertFalse( wp_slash( false ) );
+ $this->assertSame( 4, wp_slash( 4 ) );
+ $this->assertSame( 'foo', wp_slash( 'foo' ) );
$arr = array(
'a' => true,
'b' => false,
@@ -79,14 +79,14 @@ class Tests_Formatting_WPSlash extends WP_UnitTestCase {
'd' => 'foo',
);
$arr['e'] = $arr; // Add a sub-array.
- $this->assertEquals( $arr, wp_slash( $arr ) ); // Keyed array.
- $this->assertEquals( array_values( $arr ), wp_slash( array_values( $arr ) ) ); // Non-keyed.
+ $this->assertSame( $arr, wp_slash( $arr ) ); // Keyed array.
+ $this->assertSame( array_values( $arr ), wp_slash( array_values( $arr ) ) ); // Non-keyed.
$obj = new stdClass;
foreach ( $arr as $k => $v ) {
$obj->$k = $v;
}
- $this->assertEquals( $obj, wp_slash( $obj ) );
+ $this->assertSame( $obj, wp_slash( $obj ) );
}
/**
@@ -95,9 +95,9 @@ class Tests_Formatting_WPSlash extends WP_UnitTestCase {
function test_add_even_more_slashes() {
$old = 'single\\slash double\\\\slash triple\\\\\\slash';
$new = 'single\\\\slash double\\\\\\\\slash triple\\\\\\\\\\\\slash';
- $this->assertEquals( $new, wp_slash( $old ) );
- $this->assertEquals( array( 'a' => $new ), wp_slash( array( 'a' => $old ) ) ); // Keyed array.
- $this->assertEquals( array( $new ), wp_slash( array( $old ) ) ); // Non-keyed.
+ $this->assertSame( $new, wp_slash( $old ) );
+ $this->assertSame( array( 'a' => $new ), wp_slash( array( 'a' => $old ) ) ); // Keyed array.
+ $this->assertSame( array( $new ), wp_slash( array( $old ) ) ); // Non-keyed.
}
}
diff --git a/tests/phpunit/tests/formatting/WPSpecialchars.php b/tests/phpunit/tests/formatting/WPSpecialchars.php
index 2f3e9cea26..7cc131da04 100644
--- a/tests/phpunit/tests/formatting/WPSpecialchars.php
+++ b/tests/phpunit/tests/formatting/WPSpecialchars.php
@@ -6,10 +6,10 @@
class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
function test_wp_specialchars_basics() {
$html = '&<hello world>';
- $this->assertEquals( $html, _wp_specialchars( $html ) );
+ $this->assertSame( $html, _wp_specialchars( $html ) );
$double = '&<hello world>';
- $this->assertEquals( $double, _wp_specialchars( $html, ENT_NOQUOTES, false, true ) );
+ $this->assertSame( $double, _wp_specialchars( $html, ENT_NOQUOTES, false, true ) );
}
function test_allowed_entity_names() {
@@ -22,7 +22,7 @@ class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
continue;
}
$ent = '&' . $ent . ';';
- $this->assertEquals( $ent, _wp_specialchars( $ent ) );
+ $this->assertSame( $ent, _wp_specialchars( $ent ) );
}
}
@@ -32,16 +32,16 @@ class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
foreach ( $ents as $ent ) {
$escaped = '&' . $ent . ';';
$ent = '&' . $ent . ';';
- $this->assertEquals( $escaped, _wp_specialchars( $ent ) );
+ $this->assertSame( $escaped, _wp_specialchars( $ent ) );
}
}
function test_optionally_escapes_quotes() {
$source = "\"'hello!'\"";
- $this->assertEquals( '"'hello!'"', _wp_specialchars( $source, 'single' ) );
- $this->assertEquals( ""'hello!'"", _wp_specialchars( $source, 'double' ) );
- $this->assertEquals( '"'hello!'"', _wp_specialchars( $source, true ) );
- $this->assertEquals( $source, _wp_specialchars( $source ) );
+ $this->assertSame( '"'hello!'"', _wp_specialchars( $source, 'single' ) );
+ $this->assertSame( ""'hello!'"", _wp_specialchars( $source, 'double' ) );
+ $this->assertSame( '"'hello!'"', _wp_specialchars( $source, true ) );
+ $this->assertSame( $source, _wp_specialchars( $source ) );
}
/**
@@ -51,7 +51,7 @@ class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
* @dataProvider data_double_encoding
*/
function test_double_encoding( $input, $output ) {
- return $this->assertEquals( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, true ) );
+ return $this->assertSame( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, true ) );
}
function data_double_encoding() {
@@ -78,7 +78,7 @@ class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
* @dataProvider data_no_double_encoding
*/
function test_no_double_encoding( $input, $output ) {
- return $this->assertEquals( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, false ) );
+ return $this->assertSame( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, false ) );
}
function data_no_double_encoding() {
diff --git a/tests/phpunit/tests/formatting/WPStripAllTags.php b/tests/phpunit/tests/formatting/WPStripAllTags.php
index 3ef538a34f..8656af2695 100644
--- a/tests/phpunit/tests/formatting/WPStripAllTags.php
+++ b/tests/phpunit/tests/formatting/WPStripAllTags.php
@@ -9,25 +9,25 @@ class Tests_Formatting_WPStripAllTags extends WP_UnitTestCase {
function test_wp_strip_all_tags() {
$text = 'lorem
ipsum';
- $this->assertEquals( 'loremipsum', wp_strip_all_tags( $text ) );
+ $this->assertSame( 'loremipsum', wp_strip_all_tags( $text ) );
$text = "lorem
\nipsum";
- $this->assertEquals( "lorem\nipsum", wp_strip_all_tags( $text ) );
+ $this->assertSame( "lorem\nipsum", wp_strip_all_tags( $text ) );
// Test removing breaks is working.
$text = 'lorem
ipsum';
- $this->assertEquals( 'loremipsum', wp_strip_all_tags( $text, true ) );
+ $this->assertSame( 'loremipsum', wp_strip_all_tags( $text, true ) );
// Test script / style tag's contents is removed.
$text = 'loremipsum';
- $this->assertEquals( 'loremipsum', wp_strip_all_tags( $text ) );
+ $this->assertSame( 'loremipsum', wp_strip_all_tags( $text ) );
$text = "loremipsum";
- $this->assertEquals( 'loremipsum', wp_strip_all_tags( $text ) );
+ $this->assertSame( 'loremipsum', wp_strip_all_tags( $text ) );
// Test "marlformed" markup of contents.
$text = "loremipsum";
- $this->assertEquals( 'loremipsum', wp_strip_all_tags( $text ) );
+ $this->assertSame( 'loremipsum', wp_strip_all_tags( $text ) );
}
}
diff --git a/tests/phpunit/tests/formatting/WPTargetedLinkRel.php b/tests/phpunit/tests/formatting/WPTargetedLinkRel.php
index 7f461ec87a..bc58dfe9cc 100644
--- a/tests/phpunit/tests/formatting/WPTargetedLinkRel.php
+++ b/tests/phpunit/tests/formatting/WPTargetedLinkRel.php
@@ -9,61 +9,61 @@ class Tests_Targeted_Link_Rel extends WP_UnitTestCase {
public function test_add_to_links_with_target_blank() {
$content = 'Links: No rel
';
$expected = 'Links: No rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_add_to_links_with_target_foo() {
$content = 'Links: No rel
';
$expected = 'Links: No rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_target_as_first_attribute() {
$content = 'Links: No rel
';
$expected = 'Links: No rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_add_to_existing_rel() {
$content = 'Links: Existing rel
';
$expected = 'Links: Existing rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_no_duplicate_values_added() {
$content = 'Links: Existing rel
';
$expected = 'Links: Existing rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_rel_with_single_quote_delimiter() {
$content = 'Links: Existing rel
';
$expected = 'Links: Existing rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_rel_with_no_delimiter() {
$content = 'Links: Existing rel
';
$expected = 'Links: Existing rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_rel_value_spaced_and_no_delimiter() {
$content = 'Links: Existing rel
';
$expected = 'Links: Existing rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_escaped_quotes() {
$content = 'Links: Existing rel
';
$expected = 'Links: Existing rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_ignore_links_with_no_target() {
$content = 'Links: Change me Do not change me
';
$expected = 'Links: Change me Do not change me
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
/**
@@ -75,7 +75,7 @@ class Tests_Targeted_Link_Rel extends WP_UnitTestCase {
add_filter( 'wp_targeted_link_rel', '__return_empty_string' );
$content = 'Links: Do not change me
';
$expected = 'Links: Do not change me
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
/**
@@ -93,7 +93,7 @@ class Tests_Targeted_Link_Rel extends WP_UnitTestCase {
)
);
- $this->assertEquals( $expected, $post->post_content );
+ $this->assertSame( $expected, $post->post_content );
}
/**
@@ -104,7 +104,7 @@ class Tests_Targeted_Link_Rel extends WP_UnitTestCase {
public function test_wp_targeted_link_rel_should_preserve_json() {
$content = 'Links: No rel<\/a><\/p>';
$expected = 'Links: No rel<\/a><\/p>';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
/**
@@ -115,7 +115,7 @@ class Tests_Targeted_Link_Rel extends WP_UnitTestCase {
public function test_wp_targeted_link_rel_skips_style_and_scripts() {
$content = 'Links: here aq
';
$expected = 'Links: here aq
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
/**
@@ -126,13 +126,13 @@ class Tests_Targeted_Link_Rel extends WP_UnitTestCase {
public function test_ignore_entirely_serialized_content() {
$content = 'a:1:{s:4:"html";s:52:"Links: No Rel
";}';
$expected = 'a:1:{s:4:"html";s:52:"Links: No Rel
";}';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
public function test_wp_targeted_link_rel_tab_separated_values_are_split() {
$content = "Links: No rel
";
$expected = 'Links: No rel
';
- $this->assertEquals( $expected, wp_targeted_link_rel( $content ) );
+ $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
}
}
diff --git a/tests/phpunit/tests/formatting/WPTexturize.php b/tests/phpunit/tests/formatting/WPTexturize.php
index 853e0db6fe..fda1fa9730 100644
--- a/tests/phpunit/tests/formatting/WPTexturize.php
+++ b/tests/phpunit/tests/formatting/WPTexturize.php
@@ -5,30 +5,30 @@
*/
class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
function test_dashes() {
- $this->assertEquals( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) );
- $this->assertEquals( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) );
+ $this->assertSame( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) );
+ $this->assertSame( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) );
}
function test_disable() {
- $this->assertEquals( '
---&
', wptexturize( '---&
' ) );
- $this->assertEquals( '--&
', wptexturize( '--&
' ) );
+ $this->assertSame( '---&
', wptexturize( '---&
' ) );
+ $this->assertSame( '--&
', wptexturize( '--&
' ) );
- $this->assertEquals( '---&', wptexturize( '---&' ) );
- $this->assertEquals( '---&', wptexturize( '---&' ) );
- $this->assertEquals( '', wptexturize( '' ) );
- $this->assertEquals( '', wptexturize( '' ) );
- $this->assertEquals( '---&', wptexturize( '---&' ) );
+ $this->assertSame( '---&', wptexturize( '---&' ) );
+ $this->assertSame( '---&', wptexturize( '---&' ) );
+ $this->assertSame( '', wptexturize( '' ) );
+ $this->assertSame( '', wptexturize( '' ) );
+ $this->assertSame( '---&', wptexturize( '---&' ) );
- $this->assertEquals( 'href="baba" “baba”', wptexturize( 'href="baba" "baba"' ) );
+ $this->assertSame( 'href="baba" “baba”', wptexturize( 'href="baba" "baba"' ) );
$enabled_tags_inside_code = 'curl -s baba | grep sfive | cut -d "\"" -f 10 > topmp3.txt';
- $this->assertEquals( $enabled_tags_inside_code, wptexturize( $enabled_tags_inside_code ) );
+ $this->assertSame( $enabled_tags_inside_code, wptexturize( $enabled_tags_inside_code ) );
$double_nest = '"baba""baba""baba"
';
- $this->assertEquals( $double_nest, wptexturize( $double_nest ) );
+ $this->assertSame( $double_nest, wptexturize( $double_nest ) );
$invalid_nest = '"baba"
';
- $this->assertEquals( $invalid_nest, wptexturize( $invalid_nest ) );
+ $this->assertSame( $invalid_nest, wptexturize( $invalid_nest ) );
}
@@ -36,38 +36,38 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @ticket 1418
*/
function test_bracketed_quotes_1418() {
- $this->assertEquals( '(“test”)', wptexturize( '("test")' ) );
- $this->assertEquals( '(‘test’)', wptexturize( "('test')" ) );
- $this->assertEquals( '(’twas)', wptexturize( "('twas)" ) );
+ $this->assertSame( '(“test”)', wptexturize( '("test")' ) );
+ $this->assertSame( '(‘test’)', wptexturize( "('test')" ) );
+ $this->assertSame( '(’twas)', wptexturize( "('twas)" ) );
}
/**
* @ticket 3810
*/
function test_bracketed_quotes_3810() {
- $this->assertEquals( 'A dog (“Hubertus”) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
+ $this->assertSame( 'A dog (“Hubertus”) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
}
/**
* @ticket 4539
*/
function test_basic_quotes() {
- $this->assertEquals( 'test’s', wptexturize( 'test\'s' ) );
+ $this->assertSame( 'test’s', wptexturize( 'test\'s' ) );
- $this->assertEquals( '‘quoted’', wptexturize( '\'quoted\'' ) );
- $this->assertEquals( '“quoted”', wptexturize( '"quoted"' ) );
+ $this->assertSame( '‘quoted’', wptexturize( '\'quoted\'' ) );
+ $this->assertSame( '“quoted”', wptexturize( '"quoted"' ) );
- $this->assertEquals( 'space before ‘quoted’ space after', wptexturize( 'space before \'quoted\' space after' ) );
- $this->assertEquals( 'space before “quoted” space after', wptexturize( 'space before "quoted" space after' ) );
+ $this->assertSame( 'space before ‘quoted’ space after', wptexturize( 'space before \'quoted\' space after' ) );
+ $this->assertSame( 'space before “quoted” space after', wptexturize( 'space before "quoted" space after' ) );
- $this->assertEquals( '(‘quoted’)', wptexturize( '(\'quoted\')' ) );
- $this->assertEquals( '{“quoted”}', wptexturize( '{"quoted"}' ) );
+ $this->assertSame( '(‘quoted’)', wptexturize( '(\'quoted\')' ) );
+ $this->assertSame( '{“quoted”}', wptexturize( '{"quoted"}' ) );
- $this->assertEquals( '‘qu(ot)ed’', wptexturize( '\'qu(ot)ed\'' ) );
- $this->assertEquals( '“qu{ot}ed”', wptexturize( '"qu{ot}ed"' ) );
+ $this->assertSame( '‘qu(ot)ed’', wptexturize( '\'qu(ot)ed\'' ) );
+ $this->assertSame( '“qu{ot}ed”', wptexturize( '"qu{ot}ed"' ) );
- $this->assertEquals( ' ‘test’s quoted’ ', wptexturize( ' \'test\'s quoted\' ' ) );
- $this->assertEquals( ' “test’s quoted” ', wptexturize( ' "test\'s quoted" ' ) );
+ $this->assertSame( ' ‘test’s quoted’ ', wptexturize( ' \'test\'s quoted\' ' ) );
+ $this->assertSame( ' “test’s quoted” ', wptexturize( ' "test\'s quoted" ' ) );
}
/**
@@ -75,7 +75,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @ticket 15241
*/
function test_full_sentences_with_unmatched_single_quotes() {
- $this->assertEquals(
+ $this->assertSame(
'That means every moment you’re working on something without it being in the public it’s actually dying.',
wptexturize( "That means every moment you're working on something without it being in the public it's actually dying." )
);
@@ -85,64 +85,64 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @ticket 4539
*/
function test_quotes() {
- $this->assertEquals( '“Quoted String”', wptexturize( '"Quoted String"' ) );
- // $this->assertEquals( 'Here is “a test with a link”', wptexturize( 'Here is "a test with a link"' ) );
- // $this->assertEquals( 'Here is “a test with a link and a period”.', wptexturize( 'Here is "a test with a link and a period".' ) );
- $this->assertEquals( 'Here is “a test with a link” and a space.', wptexturize( 'Here is "a test with a link" and a space.' ) );
- $this->assertEquals( 'Here is “a test with a link and some text quoted”', wptexturize( 'Here is "a test with a link and some text quoted"' ) );
- // $this->assertEquals( 'Here is “a test with a link”, and a comma.', wptexturize( 'Here is "a test with a link", and a comma.' ) );
- // $this->assertEquals( 'Here is “a test with a link”; and a semi-colon.', wptexturize( 'Here is "a test with a link"; and a semi-colon.' ) );
- // $this->assertEquals( 'Here is “a test with a link”- and a dash.', wptexturize( 'Here is "a test with a link"- and a dash.' ) );
- // $this->assertEquals( 'Here is “a test with a link”… and ellipses.', wptexturize( 'Here is "a test with a link"... and ellipses.' ) );
- // $this->assertEquals( 'Here is “a test with a link”.', wptexturize( 'Here is "a test with a link".' ) );
- // $this->assertEquals( 'Here is “a test with a link”and a work stuck to the end.', wptexturize( 'Here is "a test with a link"and a work stuck to the end.' ) );
- $this->assertEquals( 'A test with a finishing number, “like 23”.', wptexturize( 'A test with a finishing number, "like 23".' ) );
- $this->assertEquals( 'A test with a number, “like 62”, is nice to have.', wptexturize( 'A test with a number, "like 62", is nice to have.' ) );
+ $this->assertSame( '“Quoted String”', wptexturize( '"Quoted String"' ) );
+ // $this->assertSame( 'Here is “a test with a link”', wptexturize( 'Here is "a test with a link"' ) );
+ // $this->assertSame( 'Here is “a test with a link and a period”.', wptexturize( 'Here is "a test with a link and a period".' ) );
+ $this->assertSame( 'Here is “a test with a link” and a space.', wptexturize( 'Here is "a test with a link" and a space.' ) );
+ $this->assertSame( 'Here is “a test with a link and some text quoted”', wptexturize( 'Here is "a test with a link and some text quoted"' ) );
+ // $this->assertSame( 'Here is “a test with a link”, and a comma.', wptexturize( 'Here is "a test with a link", and a comma.' ) );
+ // $this->assertSame( 'Here is “a test with a link”; and a semi-colon.', wptexturize( 'Here is "a test with a link"; and a semi-colon.' ) );
+ // $this->assertSame( 'Here is “a test with a link”- and a dash.', wptexturize( 'Here is "a test with a link"- and a dash.' ) );
+ // $this->assertSame( 'Here is “a test with a link”… and ellipses.', wptexturize( 'Here is "a test with a link"... and ellipses.' ) );
+ // $this->assertSame( 'Here is “a test with a link”.', wptexturize( 'Here is "a test with a link".' ) );
+ // $this->assertSame( 'Here is “a test with a link”and a work stuck to the end.', wptexturize( 'Here is "a test with a link"and a work stuck to the end.' ) );
+ $this->assertSame( 'A test with a finishing number, “like 23”.', wptexturize( 'A test with a finishing number, "like 23".' ) );
+ $this->assertSame( 'A test with a number, “like 62”, is nice to have.', wptexturize( 'A test with a number, "like 62", is nice to have.' ) );
}
/**
* @ticket 4539
*/
function test_quotes_before_s() {
- $this->assertEquals( 'test’s', wptexturize( "test's" ) );
- $this->assertEquals( '‘test’s', wptexturize( "'test's" ) );
- $this->assertEquals( '‘test’s’', wptexturize( "'test's'" ) );
- $this->assertEquals( '‘string’', wptexturize( "'string'" ) );
- $this->assertEquals( '‘string’s’', wptexturize( "'string's'" ) );
+ $this->assertSame( 'test’s', wptexturize( "test's" ) );
+ $this->assertSame( '‘test’s', wptexturize( "'test's" ) );
+ $this->assertSame( '‘test’s’', wptexturize( "'test's'" ) );
+ $this->assertSame( '‘string’', wptexturize( "'string'" ) );
+ $this->assertSame( '‘string’s’', wptexturize( "'string's'" ) );
}
/**
* @ticket 4539
*/
function test_quotes_before_numbers() {
- $this->assertEquals( 'Class of ’99', wptexturize( "Class of '99" ) );
- $this->assertEquals( 'Class of ’99’s', wptexturize( "Class of '99's" ) );
- $this->assertEquals( '‘Class of ’99’', wptexturize( "'Class of '99'" ) );
- $this->assertEquals( '‘Class of ’99’ ', wptexturize( "'Class of '99' " ) );
- $this->assertEquals( '‘Class of ’99’.', wptexturize( "'Class of '99'." ) );
- $this->assertEquals( '‘Class of ’99’, she said', wptexturize( "'Class of '99', she said" ) );
- $this->assertEquals( '‘Class of ’99’:', wptexturize( "'Class of '99':" ) );
- $this->assertEquals( '‘Class of ’99’;', wptexturize( "'Class of '99';" ) );
- $this->assertEquals( '‘Class of ’99’!', wptexturize( "'Class of '99'!" ) );
- $this->assertEquals( '‘Class of ’99’?', wptexturize( "'Class of '99'?" ) );
- $this->assertEquals( '‘Class of ’99’s’', wptexturize( "'Class of '99's'" ) );
- $this->assertEquals( '‘Class of ’99’s’', wptexturize( "'Class of '99’s'" ) );
- $this->assertEquals( '“Class of 99”', wptexturize( '"Class of 99"' ) );
- $this->assertEquals( '“Class of ’99”', wptexturize( "\"Class of '99\"" ) );
- $this->assertEquals( '{“Class of ’99”}', wptexturize( "{\"Class of '99\"}" ) );
- $this->assertEquals( ' “Class of ’99” ', wptexturize( " \"Class of '99\" " ) );
- $this->assertEquals( ' “Class of ’99”.', wptexturize( " \"Class of '99\"." ) );
- $this->assertEquals( ' “Class of ’99”, she said', wptexturize( " \"Class of '99\", she said" ) );
- $this->assertEquals( ' “Class of ’99”:', wptexturize( " \"Class of '99\":" ) );
- $this->assertEquals( ' “Class of ’99”;', wptexturize( " \"Class of '99\";" ) );
- $this->assertEquals( ' “Class of ’99”!', wptexturize( " \"Class of '99\"!" ) );
- $this->assertEquals( ' “Class of ’99”?', wptexturize( " \"Class of '99\"?" ) );
+ $this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) );
+ $this->assertSame( 'Class of ’99’s', wptexturize( "Class of '99's" ) );
+ $this->assertSame( '‘Class of ’99’', wptexturize( "'Class of '99'" ) );
+ $this->assertSame( '‘Class of ’99’ ', wptexturize( "'Class of '99' " ) );
+ $this->assertSame( '‘Class of ’99’.', wptexturize( "'Class of '99'." ) );
+ $this->assertSame( '‘Class of ’99’, she said', wptexturize( "'Class of '99', she said" ) );
+ $this->assertSame( '‘Class of ’99’:', wptexturize( "'Class of '99':" ) );
+ $this->assertSame( '‘Class of ’99’;', wptexturize( "'Class of '99';" ) );
+ $this->assertSame( '‘Class of ’99’!', wptexturize( "'Class of '99'!" ) );
+ $this->assertSame( '‘Class of ’99’?', wptexturize( "'Class of '99'?" ) );
+ $this->assertSame( '‘Class of ’99’s’', wptexturize( "'Class of '99's'" ) );
+ $this->assertSame( '‘Class of ’99’s’', wptexturize( "'Class of '99’s'" ) );
+ $this->assertSame( '“Class of 99”', wptexturize( '"Class of 99"' ) );
+ $this->assertSame( '“Class of ’99”', wptexturize( "\"Class of '99\"" ) );
+ $this->assertSame( '{“Class of ’99”}', wptexturize( "{\"Class of '99\"}" ) );
+ $this->assertSame( ' “Class of ’99” ', wptexturize( " \"Class of '99\" " ) );
+ $this->assertSame( ' “Class of ’99”.', wptexturize( " \"Class of '99\"." ) );
+ $this->assertSame( ' “Class of ’99”, she said', wptexturize( " \"Class of '99\", she said" ) );
+ $this->assertSame( ' “Class of ’99”:', wptexturize( " \"Class of '99\":" ) );
+ $this->assertSame( ' “Class of ’99”;', wptexturize( " \"Class of '99\";" ) );
+ $this->assertSame( ' “Class of ’99”!', wptexturize( " \"Class of '99\"!" ) );
+ $this->assertSame( ' “Class of ’99”?', wptexturize( " \"Class of '99\"?" ) );
// Not a quotation, may be between two other quotations.
- $this->assertEquals( '}”Class of ’99″{', wptexturize( "}\"Class of '99\"{" ) );
+ $this->assertSame( '}”Class of ’99″{', wptexturize( "}\"Class of '99\"{" ) );
}
function test_quotes_after_numbers() {
- $this->assertEquals( 'Class of ’99', wptexturize( "Class of '99" ) );
+ $this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) );
}
/**
@@ -150,43 +150,43 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @ticket 15241
*/
function test_other_html() {
- $this->assertEquals( '‘', wptexturize( "'" ) );
- // $this->assertEquals( '‘Quoted Text’,', wptexturize( "'Quoted Text'," ) );
- // $this->assertEquals( '“Quoted Text”,', wptexturize( '"Quoted Text",' ) );
+ $this->assertSame( '‘', wptexturize( "'" ) );
+ // $this->assertSame( '‘Quoted Text’,', wptexturize( "'Quoted Text'," ) );
+ // $this->assertSame( '“Quoted Text”,', wptexturize( '"Quoted Text",' ) );
}
function test_x() {
- $this->assertEquals( '14×24', wptexturize( '14x24' ) );
+ $this->assertSame( '14×24', wptexturize( '14x24' ) );
}
function test_minutes_seconds() {
- $this->assertEquals( '9′', wptexturize( '9\'' ) );
- $this->assertEquals( '9″', wptexturize( '9"' ) );
+ $this->assertSame( '9′', wptexturize( '9\'' ) );
+ $this->assertSame( '9″', wptexturize( '9"' ) );
- $this->assertEquals( 'a 9′ b', wptexturize( 'a 9\' b' ) );
- $this->assertEquals( 'a 9″ b', wptexturize( 'a 9" b' ) );
+ $this->assertSame( 'a 9′ b', wptexturize( 'a 9\' b' ) );
+ $this->assertSame( 'a 9″ b', wptexturize( 'a 9" b' ) );
- $this->assertEquals( '“a 9′ b”', wptexturize( '"a 9\' b"' ) );
- $this->assertEquals( '‘a 9″ b’', wptexturize( "'a 9\" b'" ) );
+ $this->assertSame( '“a 9′ b”', wptexturize( '"a 9\' b"' ) );
+ $this->assertSame( '‘a 9″ b’', wptexturize( "'a 9\" b'" ) );
}
/**
* @ticket 8775
*/
function test_wptexturize_quotes_around_numbers() {
- $this->assertEquals( '“12345”', wptexturize( '"12345"' ) );
- $this->assertEquals( '‘12345’', wptexturize( '\'12345\'' ) );
- $this->assertEquals( '“a 9′ plus a ‘9’, maybe a 9′ ‘9’”', wptexturize( '"a 9\' plus a \'9\', maybe a 9\' \'9\'"' ) );
- $this->assertEquals( '’99
‘123’
’tis
‘s’
', wptexturize( '\'99
\'123\'
\'tis
\'s\'
' ) );
+ $this->assertSame( '“12345”', wptexturize( '"12345"' ) );
+ $this->assertSame( '‘12345’', wptexturize( '\'12345\'' ) );
+ $this->assertSame( '“a 9′ plus a ‘9’, maybe a 9′ ‘9’”', wptexturize( '"a 9\' plus a \'9\', maybe a 9\' \'9\'"' ) );
+ $this->assertSame( '’99
‘123’
’tis
‘s’
', wptexturize( '\'99
\'123\'
\'tis
\'s\'
' ) );
}
/**
* @ticket 8912
*/
function test_wptexturize_html_comments() {
- $this->assertEquals( '', wptexturize( '' ) );
- $this->assertEquals( '', wptexturize( '' ) );
- $this->assertEquals( '', wptexturize( '' ) );
+ $this->assertSame( '', wptexturize( '' ) );
+ $this->assertSame( '', wptexturize( '' ) );
+ $this->assertSame( '', wptexturize( '' ) );
}
/**
@@ -194,15 +194,15 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @ticket 15241
*/
function test_entity_quote_cuddling() {
- $this->assertEquals( ' “Testing”', wptexturize( ' "Testing"' ) );
- // $this->assertEquals( '&“Testing”', wptexturize( '&"Testing"' ) );
+ $this->assertSame( ' “Testing”', wptexturize( ' "Testing"' ) );
+ // $this->assertSame( '&“Testing”', wptexturize( '&"Testing"' ) );
}
/**
* @ticket 22823
*/
function test_apostrophes_before_primes() {
- $this->assertEquals( 'WordPress 3.5’s release date', wptexturize( "WordPress 3.5's release date" ) );
+ $this->assertSame( 'WordPress 3.5’s release date', wptexturize( "WordPress 3.5's release date" ) );
}
/**
@@ -211,34 +211,34 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
function test_spaces_around_hyphens() {
$nbsp = "\xC2\xA0";
- $this->assertEquals( ' – ', wptexturize( ' - ' ) );
- $this->assertEquals( ' – ', wptexturize( ' - ' ) );
- $this->assertEquals( ' – ', wptexturize( ' - ' ) );
- $this->assertEquals( ' – ', wptexturize( ' - ' ) );
- $this->assertEquals( "$nbsp–$nbsp", wptexturize( "$nbsp-$nbsp" ) );
- $this->assertEquals( " –$nbsp", wptexturize( " -$nbsp" ) );
- $this->assertEquals( "$nbsp– ", wptexturize( "$nbsp- " ) );
+ $this->assertSame( ' – ', wptexturize( ' - ' ) );
+ $this->assertSame( ' – ', wptexturize( ' - ' ) );
+ $this->assertSame( ' – ', wptexturize( ' - ' ) );
+ $this->assertSame( ' – ', wptexturize( ' - ' ) );
+ $this->assertSame( "$nbsp–$nbsp", wptexturize( "$nbsp-$nbsp" ) );
+ $this->assertSame( " –$nbsp", wptexturize( " -$nbsp" ) );
+ $this->assertSame( "$nbsp– ", wptexturize( "$nbsp- " ) );
- $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
- $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
- $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
- $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
- $this->assertEquals( "$nbsp—$nbsp", wptexturize( "$nbsp--$nbsp" ) );
- $this->assertEquals( " —$nbsp", wptexturize( " --$nbsp" ) );
- $this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- " ) );
+ $this->assertSame( ' — ', wptexturize( ' -- ' ) );
+ $this->assertSame( ' — ', wptexturize( ' -- ' ) );
+ $this->assertSame( ' — ', wptexturize( ' -- ' ) );
+ $this->assertSame( ' — ', wptexturize( ' -- ' ) );
+ $this->assertSame( "$nbsp—$nbsp", wptexturize( "$nbsp--$nbsp" ) );
+ $this->assertSame( " —$nbsp", wptexturize( " --$nbsp" ) );
+ $this->assertSame( "$nbsp— ", wptexturize( "$nbsp-- " ) );
}
/**
* @ticket 31030
*/
function test_hyphens_at_start_and_end() {
- $this->assertEquals( '– ', wptexturize( '- ' ) );
- $this->assertEquals( '– –', wptexturize( '- -' ) );
- $this->assertEquals( ' –', wptexturize( ' -' ) );
+ $this->assertSame( '– ', wptexturize( '- ' ) );
+ $this->assertSame( '– –', wptexturize( '- -' ) );
+ $this->assertSame( ' –', wptexturize( ' -' ) );
- $this->assertEquals( '— ', wptexturize( '-- ' ) );
- $this->assertEquals( '— —', wptexturize( '-- --' ) );
- $this->assertEquals( ' —', wptexturize( ' --' ) );
+ $this->assertSame( '— ', wptexturize( '-- ' ) );
+ $this->assertSame( '— —', wptexturize( '-- --' ) );
+ $this->assertSame( ' —', wptexturize( ' --' ) );
}
/**
@@ -266,7 +266,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_spaces_around_quotes
*/
function test_spaces_around_quotes( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_spaces_around_quotes() {
@@ -322,7 +322,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_apos_before_digits
*/
function test_apos_before_digits( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_apos_before_digits() {
@@ -363,7 +363,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_opening_single_quote
*/
function test_opening_single_quote( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_opening_single_quote() {
@@ -492,7 +492,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_double_prime
*/
function test_double_prime( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_double_prime() {
@@ -525,7 +525,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_single_prime
*/
function test_single_prime( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_single_prime() {
@@ -558,7 +558,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_contractions
*/
function test_contractions( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_contractions() {
@@ -599,7 +599,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_opening_quote
*/
function test_opening_quote( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_opening_quote() {
@@ -676,7 +676,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_closing_quote
*/
function test_closing_quote( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_closing_quote() {
@@ -765,7 +765,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_closing_single_quote
*/
function test_closing_single_quote( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_closing_single_quote() {
@@ -855,7 +855,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_multiplication
*/
function test_multiplication( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_multiplication() {
@@ -905,7 +905,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_ampersand
*/
function test_ampersand( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_ampersand() {
@@ -970,7 +970,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_cockney
*/
function test_cockney( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_cockney() {
@@ -1031,7 +1031,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_smart_dashes
*/
function test_smart_dashes( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_smart_dashes() {
@@ -1084,7 +1084,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_misc_static_replacements
*/
function test_misc_static_replacements( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_misc_static_replacements() {
@@ -1139,7 +1139,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_quoted_numbers
*/
function test_quoted_numbers( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_quoted_numbers() {
@@ -1190,7 +1190,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_quotes_and_dashes
*/
function test_quotes_and_dashes( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_quotes_and_dashes() {
@@ -1253,7 +1253,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_tag_avoidance
*/
function test_tag_avoidance( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_tag_avoidance() {
@@ -1476,7 +1476,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_year_abbr
*/
function test_year_abbr( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_year_abbr() {
@@ -1572,7 +1572,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
remove_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
wptexturize( 'reset', true );
- return $this->assertEquals( $output, $result );
+ return $this->assertSame( $output, $result );
}
function filter_translate( $translations, $text, $context, $domain ) {
@@ -1792,7 +1792,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_element_stack
*/
function test_element_stack( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_element_stack() {
@@ -1845,7 +1845,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
function test_unregistered_shortcodes( $input, $output ) {
add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
- $output = $this->assertEquals( $output, wptexturize( $input ) );
+ $output = $this->assertSame( $output, wptexturize( $input ) );
remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
return $output;
@@ -1928,7 +1928,7 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
* @dataProvider data_primes_vs_quotes
*/
function test_primes_vs_quotes( $input, $output ) {
- return $this->assertEquals( $output, wptexturize( $input ) );
+ return $this->assertSame( $output, wptexturize( $input ) );
}
function data_primes_vs_quotes() {
@@ -1997,7 +1997,7 @@ String with a number followed by a single quote ‘Expendables 3’ vest
remove_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 );
wptexturize( 'reset', true );
- return $this->assertEquals( $output, $result );
+ return $this->assertSame( $output, $result );
}
function filter_translate2( $translations, $text, $context, $domain ) {
@@ -2103,7 +2103,7 @@ String with a number followed by a single quote !q1!Expendables 3!q1! vestibulum
* @ticket 35864
*/
function test_trailing_less_than() {
- $this->assertEquals( 'F–oo<', wptexturize( 'F--oo<', true ) );
+ $this->assertSame( 'F–oo<', wptexturize( 'F--oo<', true ) );
}
function data_whole_posts() {
diff --git a/tests/phpunit/tests/formatting/WPTrimWords.php b/tests/phpunit/tests/formatting/WPTrimWords.php
index 125bbcb9d2..10a4dd2dc9 100644
--- a/tests/phpunit/tests/formatting/WPTrimWords.php
+++ b/tests/phpunit/tests/formatting/WPTrimWords.php
@@ -16,23 +16,23 @@ class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
function test_trims_to_55_by_default() {
$trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit…';
- $this->assertEquals( $trimmed, wp_trim_words( $this->long_text ) );
+ $this->assertSame( $trimmed, wp_trim_words( $this->long_text ) );
}
function test_trims_to_10() {
$trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius…';
- $this->assertEquals( $trimmed, wp_trim_words( $this->long_text, 10 ) );
+ $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 10 ) );
}
function test_trims_to_5_and_uses_custom_more() {
$trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!';
- $this->assertEquals( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) );
+ $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) );
}
function test_strips_tags_before_trimming() {
$text = 'This text contains a link to WordPress.org!';
$trimmed = 'This text contains a link…';
- $this->assertEquals( $trimmed, wp_trim_words( $text, 5 ) );
+ $this->assertSame( $trimmed, wp_trim_words( $text, 5 ) );
}
/**
@@ -42,15 +42,15 @@ class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
$trimmed = 'This text contains. It should go.';
$text = 'This text contains. It should go.';
- $this->assertEquals( $trimmed, wp_trim_words( $text ) );
+ $this->assertSame( $trimmed, wp_trim_words( $text ) );
$text = 'This text contains. It should go.';
- $this->assertEquals( $trimmed, wp_trim_words( $text ) );
+ $this->assertSame( $trimmed, wp_trim_words( $text ) );
}
function test_doesnt_trim_short_text() {
$text = 'This is some short text.';
- $this->assertEquals( $text, wp_trim_words( $text ) );
+ $this->assertSame( $text, wp_trim_words( $text ) );
}
/**
@@ -61,7 +61,7 @@ class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
$expected = substr( $this->long_text, 0, 20 ) . '…';
$actual = wp_trim_words( $this->long_text, 20 );
restore_previous_locale();
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
/**
@@ -73,16 +73,16 @@ class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
$expected = str_repeat( 'あ', 19 ) . '…';
$actual = wp_trim_words( $text, 19 );
restore_previous_locale();
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
/**
* @ticket 47867
*/
function test_works_with_non_numeric_num_words() {
- $this->assertEquals( '', wp_trim_words( $this->long_text, '', '' ) );
- $this->assertEquals( '', wp_trim_words( $this->long_text, 'abc', '' ) );
- $this->assertEquals( '', wp_trim_words( $this->long_text, null, '' ) );
- $this->assertEquals( 'Lorem ipsum dolor', wp_trim_words( $this->long_text, '3', '' ) );
+ $this->assertSame( '', wp_trim_words( $this->long_text, '', '' ) );
+ $this->assertSame( '', wp_trim_words( $this->long_text, 'abc', '' ) );
+ $this->assertSame( '', wp_trim_words( $this->long_text, null, '' ) );
+ $this->assertSame( 'Lorem ipsum dolor', wp_trim_words( $this->long_text, '3', '' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/WpHtmlEditPre.php b/tests/phpunit/tests/formatting/WpHtmlEditPre.php
index dc39ddf050..fceabbe8db 100644
--- a/tests/phpunit/tests/formatting/WpHtmlEditPre.php
+++ b/tests/phpunit/tests/formatting/WpHtmlEditPre.php
@@ -17,7 +17,7 @@ class Tests_Formatting_WpHtmlEditPre extends WP_UnitTestCase {
function test_wp_htmledit_pre_charset_iso_8859_1() {
add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
$iso8859_1 = 'Fran' . chr( 135 ) . 'ais';
- $this->assertEquals( $iso8859_1, wp_htmledit_pre( $iso8859_1 ) );
+ $this->assertSame( $iso8859_1, wp_htmledit_pre( $iso8859_1 ) );
remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
}
@@ -31,7 +31,7 @@ class Tests_Formatting_WpHtmlEditPre extends WP_UnitTestCase {
function test_wp_htmledit_pre_charset_utf_8() {
add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
$utf8 = 'Fran' . chr( 195 ) . chr( 167 ) . 'ais';
- $this->assertEquals( $utf8, wp_htmledit_pre( $utf8 ) );
+ $this->assertSame( $utf8, wp_htmledit_pre( $utf8 ) );
remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/WpHtmlSplit.php b/tests/phpunit/tests/formatting/WpHtmlSplit.php
index adf3203827..a9baa7cb8c 100644
--- a/tests/phpunit/tests/formatting/WpHtmlSplit.php
+++ b/tests/phpunit/tests/formatting/WpHtmlSplit.php
@@ -11,7 +11,7 @@ class Tests_Formatting_WpHtmlSplit extends WP_UnitTestCase {
* @dataProvider data_basic_features
*/
function test_basic_features( $input, $output ) {
- return $this->assertEquals( $output, wp_html_split( $input ) );
+ return $this->assertSame( $output, wp_html_split( $input ) );
}
function data_basic_features() {
diff --git a/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php b/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php
index 7a6291047f..764a0cc178 100644
--- a/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php
+++ b/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php
@@ -10,7 +10,7 @@ class Tests_Formatting_WpReplaceInTags extends WP_UnitTestCase {
* @dataProvider data_wp_replace_in_html_tags
*/
function test_wp_replace_in_html_tags( $input, $output ) {
- return $this->assertEquals( $output, wp_replace_in_html_tags( $input, array( "\n" => ' ' ) ) );
+ return $this->assertSame( $output, wp_replace_in_html_tags( $input, array( "\n" => ' ' ) ) );
}
function data_wp_replace_in_html_tags() {
diff --git a/tests/phpunit/tests/formatting/WpRichEditPre.php b/tests/phpunit/tests/formatting/WpRichEditPre.php
index d5c2a072cb..79ed8b1bc6 100644
--- a/tests/phpunit/tests/formatting/WpRichEditPre.php
+++ b/tests/phpunit/tests/formatting/WpRichEditPre.php
@@ -17,7 +17,7 @@ class Tests_Formatting_WpRichEditPre extends WP_UnitTestCase {
function test_wp_richedit_pre_charset_iso_8859_1() {
add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
$iso8859_1 = 'Fran' . chr( 135 ) . 'ais';
- $this->assertEquals( '<p>' . $iso8859_1 . "</p>\n", wp_richedit_pre( $iso8859_1 ) );
+ $this->assertSame( '<p>' . $iso8859_1 . "</p>\n", wp_richedit_pre( $iso8859_1 ) );
remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
}
@@ -31,7 +31,7 @@ class Tests_Formatting_WpRichEditPre extends WP_UnitTestCase {
function test_wp_richedit_pre_charset_utf_8() {
add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
$utf8 = 'Fran' . chr( 195 ) . chr( 167 ) . 'ais';
- $this->assertEquals( '<p>' . $utf8 . "</p>\n", wp_richedit_pre( $utf8 ) );
+ $this->assertSame( '<p>' . $utf8 . "</p>\n", wp_richedit_pre( $utf8 ) );
remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/Zeroise.php b/tests/phpunit/tests/formatting/Zeroise.php
index 212d006918..0f9fd8dad4 100644
--- a/tests/phpunit/tests/formatting/Zeroise.php
+++ b/tests/phpunit/tests/formatting/Zeroise.php
@@ -5,10 +5,10 @@
*/
class Tests_Formatting_Zeroise extends WP_UnitTestCase {
function test_pads_with_leading_zeroes() {
- $this->assertEquals( '00005', zeroise( 5, 5 ) );
+ $this->assertSame( '00005', zeroise( 5, 5 ) );
}
function test_does_nothing_if_input_is_already_longer() {
- $this->assertEquals( '5000000', zeroise( 5000000, 2 ) );
+ $this->assertSame( '5000000', zeroise( 5000000, 2 ) );
}
}
diff --git a/tests/phpunit/tests/formatting/balanceTags.php b/tests/phpunit/tests/formatting/balanceTags.php
index b5dedb11f4..c39e30f29e 100644
--- a/tests/phpunit/tests/formatting/balanceTags.php
+++ b/tests/phpunit/tests/formatting/balanceTags.php
@@ -154,7 +154,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
function test_detects_traditional_tag_names( $tag ) {
$normalized = strtolower( $tag );
- $this->assertEquals( "<$normalized>inside$normalized>", balanceTags( "<$tag>inside", true ) );
+ $this->assertSame( "<$normalized>inside$normalized>", balanceTags( "<$tag>inside", true ) );
}
/**
@@ -162,7 +162,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @dataProvider supported_custom_element_tag_names
*/
function test_detects_supported_custom_element_tag_names( $tag ) {
- $this->assertEquals( "<$tag>inside$tag>", balanceTags( "<$tag>inside", true ) );
+ $this->assertSame( "<$tag>inside$tag>", balanceTags( "<$tag>inside", true ) );
}
/**
@@ -170,7 +170,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @dataProvider invalid_tag_names
*/
function test_ignores_invalid_tag_names( $input, $output ) {
- $this->assertEquals( $output, balanceTags( $input, true ) );
+ $this->assertSame( $output, balanceTags( $input, true ) );
}
/**
@@ -178,7 +178,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @dataProvider unsupported_valid_tag_names
*/
function test_ignores_unsupported_custom_tag_names( $tag ) {
- $this->assertEquals( "<$tag>inside", balanceTags( "<$tag>inside", true ) );
+ $this->assertSame( "<$tag>inside", balanceTags( "<$tag>inside", true ) );
}
/**
@@ -186,7 +186,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @dataProvider supported_invalid_tag_names
*/
function test_detects_supported_invalid_tag_names( $tag ) {
- $this->assertEquals( "<$tag>inside$tag>", balanceTags( "<$tag>inside", true ) );
+ $this->assertSame( "<$tag>inside$tag>", balanceTags( "<$tag>inside", true ) );
}
/**
@@ -196,7 +196,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @dataProvider single_tags
*/
function test_selfcloses_unclosed_known_single_tags( $tag ) {
- $this->assertEquals( "<$tag />", balanceTags( "<$tag>", true ) );
+ $this->assertSame( "<$tag />", balanceTags( "<$tag>", true ) );
}
/**
@@ -207,7 +207,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @dataProvider single_tags
*/
function test_selfcloses_known_single_tags_having_closing_tag( $tag ) {
- $this->assertEquals( "<$tag />", balanceTags( "<$tag>$tag>", true ) );
+ $this->assertSame( "<$tag />", balanceTags( "<$tag>$tag>", true ) );
}
/**
@@ -232,7 +232,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -247,7 +247,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -260,7 +260,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $inputs[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $inputs[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -280,7 +280,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -294,7 +294,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $inputs[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $inputs[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -303,7 +303,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
*/
function test_allows_immediately_nested_object_tags() {
$object = '';
- $this->assertEquals( $object, balanceTags( $object, true ) );
+ $this->assertSame( $object, balanceTags( $object, true ) );
}
function test_balances_nested_non_nestable_tags() {
@@ -317,7 +317,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -332,7 +332,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -353,7 +353,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -372,7 +372,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
);
foreach ( $inputs as $key => $input ) {
- $this->assertEquals( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
+ $this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}
@@ -438,6 +438,6 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
* @param string $expected Expected.
*/
public function test_custom_elements( $source, $expected ) {
- $this->assertEquals( $expected, balanceTags( $source, true ) );
+ $this->assertSame( $expected, balanceTags( $source, true ) );
}
}
diff --git a/tests/phpunit/tests/formatting/date.php b/tests/phpunit/tests/formatting/date.php
index fce5494f87..ac87159996 100644
--- a/tests/phpunit/tests/formatting/date.php
+++ b/tests/phpunit/tests/formatting/date.php
@@ -15,7 +15,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
update_option( 'timezone_string', 'Europe/London' );
$local = '2012-01-01 12:34:56';
$gmt = $local;
- $this->assertEquals( $local, get_date_from_gmt( $gmt ) );
+ $this->assertSame( $local, get_date_from_gmt( $gmt ) );
}
/**
@@ -27,7 +27,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
update_option( 'timezone_string', 'Europe/London' );
$gmt = '2012-06-01 12:34:56';
$local = '2012-06-01 13:34:56';
- $this->assertEquals( $local, get_date_from_gmt( $gmt ) );
+ $this->assertSame( $local, get_date_from_gmt( $gmt ) );
}
/**
@@ -37,7 +37,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
update_option( 'timezone_string', 'Europe/London' );
$local = '2012-01-01 12:34:56';
$gmt = $local;
- $this->assertEquals( $gmt, get_gmt_from_date( $local ) );
+ $this->assertSame( $gmt, get_gmt_from_date( $local ) );
}
/**
@@ -47,7 +47,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
update_option( 'timezone_string', 'Europe/London' );
$local = '2012-06-01 12:34:56';
$gmt = '2012-06-01 11:34:56';
- $this->assertEquals( $gmt, get_gmt_from_date( $local ) );
+ $this->assertSame( $gmt, get_gmt_from_date( $local ) );
}
/**
@@ -56,7 +56,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
function test_get_date_and_time_from_gmt_no_timezone() {
$local = '2012-01-01 12:34:56';
$gmt = $local;
- $this->assertEquals( $gmt, get_date_from_gmt( $local ) );
+ $this->assertSame( $gmt, get_date_from_gmt( $local ) );
}
/**
@@ -65,7 +65,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
function test_get_gmt_from_date_no_timezone() {
$gmt = '2012-12-01 00:00:00';
$date = '2012-12-01';
- $this->assertEquals( $gmt, get_gmt_from_date( $date ) );
+ $this->assertSame( $gmt, get_gmt_from_date( $date ) );
}
/**
@@ -75,7 +75,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
update_option( 'timezone_string', 'Europe/London' );
$local = '2012-12-01';
$gmt = '2012-12-01 00:00:00';
- $this->assertEquals( $gmt, get_gmt_from_date( $local ) );
+ $this->assertSame( $gmt, get_gmt_from_date( $local ) );
}
/**
@@ -110,7 +110,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
$utc = $local->setTimezone( new DateTimeZone( 'UTC' ) );
$mysql_local = $local->format( 'Y-m-d H:i:s' );
- $this->assertEquals( $utc->format( DATE_RFC3339 ), get_gmt_from_date( $mysql_local, DATE_RFC3339 ) );
+ $this->assertSame( $utc->format( DATE_RFC3339 ), get_gmt_from_date( $mysql_local, DATE_RFC3339 ) );
}
/**
@@ -126,7 +126,7 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
$utc = $local->setTimezone( new DateTimeZone( 'UTC' ) );
$mysql_utc = $utc->format( 'Y-m-d H:i:s' );
- $this->assertEquals( $local->format( DATE_RFC3339 ), get_date_from_gmt( $mysql_utc, DATE_RFC3339 ) );
+ $this->assertSame( $local->format( DATE_RFC3339 ), get_date_from_gmt( $mysql_utc, DATE_RFC3339 ) );
}
/**
@@ -144,45 +144,45 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
$local = new DateTimeImmutable( 'now', wp_timezone() );
$utc = $local->setTimezone( new DateTimeZone( 'UTC' ) );
- $this->assertEquals(
+ $this->assertSame(
$local->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $local->format( $format ) ),
'Local time from local time.'
);
- $this->assertEquals(
+ $this->assertSame(
$utc->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $local->format( $format ), 'gmt' ),
'UTC time from local time.'
);
- $this->assertEquals(
+ $this->assertSame(
$local->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $local->format( $format_no_tz ) ),
'Local time from local time w/o timezone.'
);
- $this->assertEquals(
+ $this->assertSame(
$utc->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $local->format( $format_no_tz ), 'gmt' ),
'UTC time from local time w/o timezone.'
);
- $this->assertEquals(
+ $this->assertSame(
$local->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $utc->format( $format ) ),
'Local time from UTC time.'
);
- $this->assertEquals(
+ $this->assertSame(
$utc->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $utc->format( $format ), 'gmt' ),
'UTC time from UTC time.'
);
- $this->assertEquals(
+ $this->assertSame(
$local->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $utc->format( $format_no_tz ) . 'Z' ),
'Local time from UTC w/ Z timezone.'
);
- $this->assertEquals(
+ $this->assertSame(
$utc->format( 'Y-m-d H:i:s' ),
iso8601_to_datetime( $utc->format( $format_no_tz ) . 'Z', 'gmt' ),
'UTC time from UTC w/ Z timezone.'
diff --git a/tests/phpunit/tests/formatting/ent2ncr.php b/tests/phpunit/tests/formatting/ent2ncr.php
index ea9b8da073..ba84e6d2e0 100644
--- a/tests/phpunit/tests/formatting/ent2ncr.php
+++ b/tests/phpunit/tests/formatting/ent2ncr.php
@@ -10,7 +10,7 @@ class Tests_Formatting_Ent2NCR extends WP_UnitTestCase {
function test_converts_named_entities_to_numeric_character_references( $entity, $ncr ) {
$entity = '&' . $entity . ';';
$ncr = '' . $ncr . ';';
- $this->assertEquals( $ncr, ent2ncr( $entity ), $entity );
+ $this->assertSame( $ncr, ent2ncr( $entity ), $entity );
}
/**
diff --git a/tests/phpunit/tests/formatting/isoDescrambler.php b/tests/phpunit/tests/formatting/isoDescrambler.php
index 32a717b948..c1133c4bcf 100644
--- a/tests/phpunit/tests/formatting/isoDescrambler.php
+++ b/tests/phpunit/tests/formatting/isoDescrambler.php
@@ -9,6 +9,6 @@ class Test_WP_ISO_Descrambler extends WP_UnitTestCase {
* =?iso-8859-1?q?this=20is=20some=20text?=
*/
function test_decodes_iso_8859_1_rfc2047_q_encoding() {
- $this->assertEquals( 'this is some text', wp_iso_descrambler( '=?iso-8859-1?q?this=20is=20some=20text?=' ) );
+ $this->assertSame( 'this is some text', wp_iso_descrambler( '=?iso-8859-1?q?this=20is=20some=20text?=' ) );
}
}
diff --git a/tests/phpunit/tests/formatting/redirect.php b/tests/phpunit/tests/formatting/redirect.php
index c79e1433eb..93aaee3d5f 100644
--- a/tests/phpunit/tests/formatting/redirect.php
+++ b/tests/phpunit/tests/formatting/redirect.php
@@ -46,34 +46,34 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
}
function test_wp_sanitize_redirect() {
- $this->assertEquals( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0Ago' ) );
- $this->assertEquals( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0ago' ) );
- $this->assertEquals( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0Dgo' ) );
- $this->assertEquals( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0dgo' ) );
- $this->assertEquals( 'http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay', wp_sanitize_redirect( 'http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay' ) );
- $this->assertEquals( 'http://example.com/watchtheutf8convert%F0%9D%8C%86', wp_sanitize_redirect( "http://example.com/watchtheutf8convert\xf0\x9d\x8c\x86" ) );
+ $this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0Ago' ) );
+ $this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0ago' ) );
+ $this->assertSame( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0Dgo' ) );
+ $this->assertSame( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0dgo' ) );
+ $this->assertSame( 'http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay', wp_sanitize_redirect( 'http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay' ) );
+ $this->assertSame( 'http://example.com/watchtheutf8convert%F0%9D%8C%86', wp_sanitize_redirect( "http://example.com/watchtheutf8convert\xf0\x9d\x8c\x86" ) );
// Nesting checks.
- $this->assertEquals( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0%0ddgo' ) );
- $this->assertEquals( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0%0DDgo' ) );
- $this->assertEquals( 'http://example.com/whyisthisintheurl/?param[1]=foo', wp_sanitize_redirect( 'http://example.com/whyisthisintheurl/?param[1]=foo' ) );
- $this->assertEquals( 'http://[2606:2800:220:6d:26bf:1447:aa7]/', wp_sanitize_redirect( 'http://[2606:2800:220:6d:26bf:1447:aa7]/' ) );
- $this->assertEquals( 'http://example.com/search.php?search=(amistillhere)', wp_sanitize_redirect( 'http://example.com/search.php?search=(amistillhere)' ) );
- $this->assertEquals( 'http://example.com/@username', wp_sanitize_redirect( 'http://example.com/@username' ) );
+ $this->assertSame( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0%0ddgo' ) );
+ $this->assertSame( 'http://example.com/watchthecarriagereturngo', wp_sanitize_redirect( 'http://example.com/watchthecarriagereturn%0%0DDgo' ) );
+ $this->assertSame( 'http://example.com/whyisthisintheurl/?param[1]=foo', wp_sanitize_redirect( 'http://example.com/whyisthisintheurl/?param[1]=foo' ) );
+ $this->assertSame( 'http://[2606:2800:220:6d:26bf:1447:aa7]/', wp_sanitize_redirect( 'http://[2606:2800:220:6d:26bf:1447:aa7]/' ) );
+ $this->assertSame( 'http://example.com/search.php?search=(amistillhere)', wp_sanitize_redirect( 'http://example.com/search.php?search=(amistillhere)' ) );
+ $this->assertSame( 'http://example.com/@username', wp_sanitize_redirect( 'http://example.com/@username' ) );
}
/**
* @group 36998
*/
function test_wp_sanitize_redirect_should_encode_spaces() {
- $this->assertEquals( 'http://example.com/test%20spaces', wp_sanitize_redirect( 'http://example.com/test%20spaces' ) );
- $this->assertEquals( 'http://example.com/test%20spaces%20in%20url', wp_sanitize_redirect( 'http://example.com/test spaces in url' ) );
+ $this->assertSame( 'http://example.com/test%20spaces', wp_sanitize_redirect( 'http://example.com/test%20spaces' ) );
+ $this->assertSame( 'http://example.com/test%20spaces%20in%20url', wp_sanitize_redirect( 'http://example.com/test spaces in url' ) );
}
/**
* @dataProvider valid_url_provider
*/
function test_wp_validate_redirect_valid_url( $url, $expected ) {
- $this->assertEquals( $expected, wp_validate_redirect( $url ) );
+ $this->assertSame( $expected, wp_validate_redirect( $url ) );
}
/**
@@ -183,7 +183,7 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
// Set the global to current URI.
$_SERVER['REQUEST_URI'] = $current_uri;
- $this->assertEquals( $expected, wp_validate_redirect( $url, false ) );
+ $this->assertSame( $expected, wp_validate_redirect( $url, false ) );
// Delete or reset the global as required.
if ( $unset ) {
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index ad7ba280d9..6099901aed 100644
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -9,7 +9,7 @@ class Tests_Functions extends WP_UnitTestCase {
$x->_baba = 5;
$x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$x->a = array( 5, 111, 'x' );
- $this->assertEquals(
+ $this->assertSame(
array(
'_baba' => 5,
'yZ' => 'baba',
@@ -18,19 +18,19 @@ class Tests_Functions extends WP_UnitTestCase {
wp_parse_args( $x )
);
$y = new MockClass;
- $this->assertEquals( array(), wp_parse_args( $y ) );
+ $this->assertSame( array(), wp_parse_args( $y ) );
}
function test_wp_parse_args_array() {
// Arrays.
$a = array();
- $this->assertEquals( array(), wp_parse_args( $a ) );
+ $this->assertSame( array(), wp_parse_args( $a ) );
$b = array(
'_baba' => 5,
'yZ' => 'baba',
'a' => array( 5, 111, 'x' ),
);
- $this->assertEquals(
+ $this->assertSame(
array(
'_baba' => 5,
'yZ' => 'baba',
@@ -46,7 +46,7 @@ class Tests_Functions extends WP_UnitTestCase {
$x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$x->a = array( 5, 111, 'x' );
$d = array( 'pu' => 'bu' );
- $this->assertEquals(
+ $this->assertSame(
array(
'pu' => 'bu',
'_baba' => 5,
@@ -56,7 +56,7 @@ class Tests_Functions extends WP_UnitTestCase {
wp_parse_args( $x, $d )
);
$e = array( '_baba' => 6 );
- $this->assertEquals(
+ $this->assertSame(
array(
'_baba' => 5,
'yZ' => 'baba',
@@ -69,10 +69,10 @@ class Tests_Functions extends WP_UnitTestCase {
function test_wp_parse_args_other() {
$b = true;
wp_parse_str( $b, $s );
- $this->assertEquals( $s, wp_parse_args( $b ) );
+ $this->assertSame( $s, wp_parse_args( $b ) );
$q = 'x=5&_baba=dudu&';
wp_parse_str( $q, $ss );
- $this->assertEquals( $ss, wp_parse_args( $q ) );
+ $this->assertSame( $ss, wp_parse_args( $q ) );
}
/**
@@ -136,7 +136,7 @@ class Tests_Functions extends WP_UnitTestCase {
* @dataProvider data_wp_normalize_path
*/
function test_wp_normalize_path( $path, $expected ) {
- $this->assertEquals( $expected, wp_normalize_path( $path ) );
+ $this->assertSame( $expected, wp_normalize_path( $path ) );
}
function data_wp_normalize_path() {
@@ -168,32 +168,32 @@ class Tests_Functions extends WP_UnitTestCase {
$testdir = DIR_TESTDATA . '/images/';
// Sanity check.
- $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcdefg.png' ), 'Sanitiy check failed' );
+ $this->assertSame( 'abcdefg.png', wp_unique_filename( $testdir, 'abcdefg.png' ), 'Sanitiy check failed' );
// Check number is appended for file already exists.
$this->assertFileExists( $testdir . 'test-image.png', 'Test image does not exist' );
- $this->assertEquals( 'test-image-1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' );
+ $this->assertSame( 'test-image-1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' );
$this->assertFileNotExists( $testdir . 'test-image-1.png' );
// Check special chars.
- $this->assertEquals( 'testtest-image.png', wp_unique_filename( $testdir, 'testtést-imagé.png' ), 'Filename with special chars failed' );
+ $this->assertSame( 'testtest-image.png', wp_unique_filename( $testdir, 'testtést-imagé.png' ), 'Filename with special chars failed' );
// Check special chars with potential conflicting name.
- $this->assertEquals( 'test-image-1.png', wp_unique_filename( $testdir, 'tést-imagé.png' ), 'Filename with special chars failed' );
+ $this->assertSame( 'test-image-1.png', wp_unique_filename( $testdir, 'tést-imagé.png' ), 'Filename with special chars failed' );
// Check with single quotes in name (somehow).
- $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' );
+ $this->assertSame( 'abcdefgh.png', wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' );
// Check with double quotes in name (somehow).
- $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
+ $this->assertSame( 'abcdefgh.png', wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
// Test crazy name (useful for regression tests).
- $this->assertEquals( '12af34567890@..^_qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' );
+ $this->assertSame( '12af34567890@..^_qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' );
// Test slashes in names.
- $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' );
- $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\fg.png' ), 'Double slashed not removed' );
- $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\\fg.png' ), 'Tripple slashed not removed' );
+ $this->assertSame( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' );
+ $this->assertSame( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\fg.png' ), 'Double slashed not removed' );
+ $this->assertSame( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\\fg.png' ), 'Tripple slashed not removed' );
}
/**
@@ -205,12 +205,12 @@ class Tests_Functions extends WP_UnitTestCase {
add_filter( 'upload_dir', array( $this, 'upload_dir_patch_basedir' ) );
// Test collision with "dimension-like" original filename.
- $this->assertEquals( 'one-blue-pixel-100x100-1.png', wp_unique_filename( $testdir, 'one-blue-pixel-100x100.png' ) );
+ $this->assertSame( 'one-blue-pixel-100x100-1.png', wp_unique_filename( $testdir, 'one-blue-pixel-100x100.png' ) );
// Test collision with existing sub-size filename.
// Existing files: one-blue-pixel-100x100.png, one-blue-pixel-1-100x100.png.
- $this->assertEquals( 'one-blue-pixel-2.png', wp_unique_filename( $testdir, 'one-blue-pixel.png' ) );
+ $this->assertSame( 'one-blue-pixel-2.png', wp_unique_filename( $testdir, 'one-blue-pixel.png' ) );
// Same as above with upper case extension.
- $this->assertEquals( 'one-blue-pixel-2.png', wp_unique_filename( $testdir, 'one-blue-pixel.PNG' ) );
+ $this->assertSame( 'one-blue-pixel-2.png', wp_unique_filename( $testdir, 'one-blue-pixel.PNG' ) );
remove_filter( 'upload_dir', array( $this, 'upload_dir_patch_basedir' ) );
}
@@ -368,9 +368,9 @@ class Tests_Functions extends WP_UnitTestCase {
foreach ( $urls as $url ) {
$_SERVER['REQUEST_URI'] = 'nothing';
- $this->assertEquals( "$url?foo=1", add_query_arg( 'foo', '1', $url ) );
- $this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
- $this->assertEquals(
+ $this->assertSame( "$url?foo=1", add_query_arg( 'foo', '1', $url ) );
+ $this->assertSame( "$url?foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
+ $this->assertSame(
"$url?foo=2",
add_query_arg(
array(
@@ -380,7 +380,7 @@ class Tests_Functions extends WP_UnitTestCase {
$url
)
);
- $this->assertEquals(
+ $this->assertSame(
"$url?foo=1&bar=2",
add_query_arg(
array(
@@ -393,9 +393,9 @@ class Tests_Functions extends WP_UnitTestCase {
$_SERVER['REQUEST_URI'] = $url;
- $this->assertEquals( "$url?foo=1", add_query_arg( 'foo', '1' ) );
- $this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ) ) );
- $this->assertEquals(
+ $this->assertSame( "$url?foo=1", add_query_arg( 'foo', '1' ) );
+ $this->assertSame( "$url?foo=1", add_query_arg( array( 'foo' => '1' ) ) );
+ $this->assertSame(
"$url?foo=2",
add_query_arg(
array(
@@ -404,7 +404,7 @@ class Tests_Functions extends WP_UnitTestCase {
)
)
);
- $this->assertEquals(
+ $this->assertSame(
"$url?foo=1&bar=2",
add_query_arg(
array(
@@ -419,9 +419,9 @@ class Tests_Functions extends WP_UnitTestCase {
$_SERVER['REQUEST_URI'] = 'nothing';
$url = str_replace( '#frag', '', $frag_url );
- $this->assertEquals( "$url?foo=1#frag", add_query_arg( 'foo', '1', $frag_url ) );
- $this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ), $frag_url ) );
- $this->assertEquals(
+ $this->assertSame( "$url?foo=1#frag", add_query_arg( 'foo', '1', $frag_url ) );
+ $this->assertSame( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ), $frag_url ) );
+ $this->assertSame(
"$url?foo=2#frag",
add_query_arg(
array(
@@ -431,7 +431,7 @@ class Tests_Functions extends WP_UnitTestCase {
$frag_url
)
);
- $this->assertEquals(
+ $this->assertSame(
"$url?foo=1&bar=2#frag",
add_query_arg(
array(
@@ -444,9 +444,9 @@ class Tests_Functions extends WP_UnitTestCase {
$_SERVER['REQUEST_URI'] = $frag_url;
- $this->assertEquals( "$url?foo=1#frag", add_query_arg( 'foo', '1' ) );
- $this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ) ) );
- $this->assertEquals(
+ $this->assertSame( "$url?foo=1#frag", add_query_arg( 'foo', '1' ) );
+ $this->assertSame( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ) ) );
+ $this->assertSame(
"$url?foo=2#frag",
add_query_arg(
array(
@@ -455,7 +455,7 @@ class Tests_Functions extends WP_UnitTestCase {
)
)
);
- $this->assertEquals(
+ $this->assertSame(
"$url?foo=1&bar=2#frag",
add_query_arg(
array(
@@ -481,9 +481,9 @@ class Tests_Functions extends WP_UnitTestCase {
foreach ( $qs_urls as $url ) {
$_SERVER['REQUEST_URI'] = 'nothing';
- $this->assertEquals( "$url&foo=1", add_query_arg( 'foo', '1', $url ) );
- $this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
- $this->assertEquals(
+ $this->assertSame( "$url&foo=1", add_query_arg( 'foo', '1', $url ) );
+ $this->assertSame( "$url&foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
+ $this->assertSame(
"$url&foo=2",
add_query_arg(
array(
@@ -493,7 +493,7 @@ class Tests_Functions extends WP_UnitTestCase {
$url
)
);
- $this->assertEquals(
+ $this->assertSame(
"$url&foo=1&bar=2",
add_query_arg(
array(
@@ -506,9 +506,9 @@ class Tests_Functions extends WP_UnitTestCase {
$_SERVER['REQUEST_URI'] = $url;
- $this->assertEquals( "$url&foo=1", add_query_arg( 'foo', '1' ) );
- $this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ) ) );
- $this->assertEquals(
+ $this->assertSame( "$url&foo=1", add_query_arg( 'foo', '1' ) );
+ $this->assertSame( "$url&foo=1", add_query_arg( array( 'foo' => '1' ) ) );
+ $this->assertSame(
"$url&foo=2",
add_query_arg(
array(
@@ -517,7 +517,7 @@ class Tests_Functions extends WP_UnitTestCase {
)
)
);
- $this->assertEquals(
+ $this->assertSame(
"$url&foo=1&bar=2",
add_query_arg(
array(
@@ -536,7 +536,7 @@ class Tests_Functions extends WP_UnitTestCase {
*/
function test_add_query_arg_numeric_keys() {
$url = add_query_arg( array( 'foo' => 'bar' ), '1=1' );
- $this->assertEquals( '1=1&foo=bar', $url );
+ $this->assertSame( '1=1&foo=bar', $url );
$url = add_query_arg(
array(
@@ -545,10 +545,10 @@ class Tests_Functions extends WP_UnitTestCase {
),
'1=1'
);
- $this->assertEquals( '1=2&foo=bar', $url );
+ $this->assertSame( '1=2&foo=bar', $url );
$url = add_query_arg( array( '1' => '2' ), 'foo=bar' );
- $this->assertEquals( 'foo=bar&1=2', $url );
+ $this->assertSame( 'foo=bar&1=2', $url );
}
/**
@@ -600,7 +600,7 @@ class Tests_Functions extends WP_UnitTestCase {
$mimes2 = wp_get_mime_types();
$this->assertInternalType( 'array', $mimes2 );
$this->assertNotEmpty( $mimes2 );
- $this->assertEquals( $mimes2, $mimes );
+ $this->assertSame( $mimes2, $mimes );
}
/**
@@ -610,32 +610,32 @@ class Tests_Functions extends WP_UnitTestCase {
$orig_blog_charset = get_option( 'blog_charset' );
update_option( 'blog_charset', 'utf8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'utf-8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'UTF8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'UTF-8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'ISO-8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'ISO8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'iso8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'iso-8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
// Arbitrary strings are passed through.
update_option( 'blog_charset', 'foobarbaz' );
- $this->assertEquals( 'foobarbaz', get_option( 'blog_charset' ) );
+ $this->assertSame( 'foobarbaz', get_option( 'blog_charset' ) );
update_option( 'blog_charset', $orig_blog_charset );
}
@@ -706,7 +706,7 @@ class Tests_Functions extends WP_UnitTestCase {
$_SERVER['HTTP_USER_AGENT'] = $user_agent;
$actual = _device_can_upload();
unset( $_SERVER['HTTP_USER_AGENT'] );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function data_device_can_upload() {
@@ -888,14 +888,14 @@ class Tests_Functions extends WP_UnitTestCase {
$this->assertNotEmpty( $urls );
$this->assertInternalType( 'array', $urls );
$this->assertCount( count( $original_urls ), $urls );
- $this->assertEquals( $original_urls, $urls );
+ $this->assertSame( $original_urls, $urls );
$exploded = array_values( array_filter( array_map( 'trim', explode( "\n", $blob ) ) ) );
// wp_extract_urls() calls html_entity_decode().
$decoded = array_map( 'html_entity_decode', $exploded );
- $this->assertEquals( $decoded, $urls );
- $this->assertEquals( $original_urls, $decoded );
+ $this->assertSame( $decoded, $urls );
+ $this->assertSame( $original_urls, $decoded );
$blob = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html et dolore magna aliqua.
@@ -909,7 +909,7 @@ class Tests_Functions extends WP_UnitTestCase {
$this->assertNotEmpty( $urls );
$this->assertInternalType( 'array', $urls );
$this->assertCount( 8, $urls );
- $this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls );
+ $this->assertSame( array_slice( $original_urls, 0, 8 ), $urls );
$blob = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore 343462^ et dolore magna aliqua.
@@ -923,21 +923,21 @@ class Tests_Functions extends WP_UnitTestCase {
$this->assertNotEmpty( $urls );
$this->assertInternalType( 'array', $urls );
$this->assertCount( 8, $urls );
- $this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls );
+ $this->assertSame( array_slice( $original_urls, 0, 8 ), $urls );
}
/**
* @ticket 28786
*/
function test_wp_json_encode() {
- $this->assertEquals( wp_json_encode( 'a' ), '"a"' );
+ $this->assertSame( wp_json_encode( 'a' ), '"a"' );
}
/**
* @ticket 28786
*/
function test_wp_json_encode_utf8() {
- $this->assertEquals( wp_json_encode( '这' ), '"\u8fd9"' );
+ $this->assertSame( wp_json_encode( '这' ), '"\u8fd9"' );
}
/**
@@ -958,9 +958,9 @@ class Tests_Functions extends WP_UnitTestCase {
$eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
$utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
- $this->assertEquals( 'aあb', $utf8 );
+ $this->assertSame( 'aあb', $utf8 );
- $this->assertEquals( '"a\u3042b"', wp_json_encode( $eucjp ) );
+ $this->assertSame( '"a\u3042b"', wp_json_encode( $eucjp ) );
mb_detect_order( $old_charsets );
}
@@ -983,9 +983,9 @@ class Tests_Functions extends WP_UnitTestCase {
$eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
$utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
- $this->assertEquals( 'aあb', $utf8 );
+ $this->assertSame( 'aあb', $utf8 );
- $this->assertEquals( '["c","a\u3042b"]', wp_json_encode( array( 'c', $eucjp ) ) );
+ $this->assertSame( '["c","a\u3042b"]', wp_json_encode( array( 'c', $eucjp ) ) );
mb_detect_order( $old_charsets );
}
@@ -994,7 +994,7 @@ class Tests_Functions extends WP_UnitTestCase {
* @ticket 28786
*/
function test_wp_json_encode_array() {
- $this->assertEquals( wp_json_encode( array( 'a' ) ), '["a"]' );
+ $this->assertSame( wp_json_encode( array( 'a' ) ), '["a"]' );
}
/**
@@ -1003,7 +1003,7 @@ class Tests_Functions extends WP_UnitTestCase {
function test_wp_json_encode_object() {
$object = new stdClass;
$object->a = 'b';
- $this->assertEquals( wp_json_encode( $object ), '{"a":"b"}' );
+ $this->assertSame( wp_json_encode( $object ), '{"a":"b"}' );
}
/**
@@ -1028,7 +1028,7 @@ class Tests_Functions extends WP_UnitTestCase {
$this->assertTrue( is_string( $date_return ), 'The date return must be a string' );
$this->assertNotEmpty( $date_return, 'The date return could not be an empty string' );
- $this->assertEquals( $expected, $date_return, 'The date does not match' );
+ $this->assertSame( $expected, $date_return, 'The date does not match' );
$this->assertEquals( new DateTime( $expected ), new DateTime( $date_return ), 'The date is not the same after the call method' );
}
@@ -1069,8 +1069,8 @@ class Tests_Functions extends WP_UnitTestCase {
foreach ( $extensions as $type => $extension_list ) {
foreach ( $extension_list as $extension ) {
- $this->assertEquals( $type, wp_ext2type( $extension ) );
- $this->assertEquals( $type, wp_ext2type( strtoupper( $extension ) ) );
+ $this->assertSame( $type, wp_ext2type( $extension ) );
+ $this->assertSame( $type, wp_ext2type( strtoupper( $extension ) ) );
}
}
@@ -1095,7 +1095,7 @@ class Tests_Functions extends WP_UnitTestCase {
$ini_limit_after = ini_get( 'memory_limit' );
$this->assertSame( $ini_limit_before, $ini_limit_after );
- $this->assertSame( false, $raised_limit );
+ $this->assertFalse( $raised_limit );
$this->assertEquals( WP_MAX_MEMORY_LIMIT, $ini_limit_after );
}
@@ -1114,7 +1114,7 @@ class Tests_Functions extends WP_UnitTestCase {
}
$unique_uuids = array_unique( $uuids );
- $this->assertEquals( $uuids, $unique_uuids );
+ $this->assertSame( $uuids, $unique_uuids );
}
/**
@@ -1183,7 +1183,7 @@ class Tests_Functions extends WP_UnitTestCase {
$this->assertTrue( is_numeric( $id ) );
$ids[] = $id;
}
- $this->assertEquals( $ids, array_unique( $ids ) );
+ $this->assertSame( $ids, array_unique( $ids ) );
// Test with prefix.
$ids = array();
@@ -1192,7 +1192,7 @@ class Tests_Functions extends WP_UnitTestCase {
$this->assertRegExp( '/^foo-\d+$/', $id );
$ids[] = $id;
}
- $this->assertEquals( $ids, array_unique( $ids ) );
+ $this->assertSame( $ids, array_unique( $ids ) );
}
/**
@@ -1204,7 +1204,7 @@ class Tests_Functions extends WP_UnitTestCase {
$this->markTestSkipped( 'The exif PHP extension is not loaded.' );
}
- $this->assertEquals( $expected, wp_get_image_mime( $file ) );
+ $this->assertSame( $expected, wp_get_image_mime( $file ) );
}
/**
@@ -1216,7 +1216,7 @@ class Tests_Functions extends WP_UnitTestCase {
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
}
- $this->assertEquals( $expected, wp_check_filetype_and_ext( $file, $filename ) );
+ $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) );
}
/**
@@ -1238,7 +1238,7 @@ class Tests_Functions extends WP_UnitTestCase {
);
add_filter( 'upload_mimes', array( $this, '_filter_mime_types_svg' ) );
- $this->assertEquals( $expected, wp_check_filetype_and_ext( $file, $filename ) );
+ $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) );
// Cleanup.
remove_filter( 'upload_mimes', array( $this, '_test_add_mime_types_svg' ) );
@@ -1263,7 +1263,7 @@ class Tests_Functions extends WP_UnitTestCase {
);
add_filter( 'upload_mimes', array( $this, '_filter_mime_types_woff' ) );
- $this->assertEquals( $expected, wp_check_filetype_and_ext( $file, $filename ) );
+ $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) );
// Cleanup.
remove_filter( 'upload_mimes', array( $this, '_test_add_mime_types_woff' ) );
diff --git a/tests/phpunit/tests/functions/allowedProtocols.php b/tests/phpunit/tests/functions/allowedProtocols.php
index 6ac0ec0f2f..9caf236074 100644
--- a/tests/phpunit/tests/functions/allowedProtocols.php
+++ b/tests/phpunit/tests/functions/allowedProtocols.php
@@ -29,8 +29,8 @@ class Tests_Functions_AllowedProtocols extends WP_UnitTestCase {
* @param string Example URL.
*/
function test_allowed_protocols( $protocol, $url ) {
- $this->assertEquals( $url, esc_url( $url, $protocol ) );
- $this->assertEquals( $url, esc_url( $url, wp_allowed_protocols() ) );
+ $this->assertSame( $url, esc_url( $url, $protocol ) );
+ $this->assertSame( $url, esc_url( $url, wp_allowed_protocols() ) );
}
/**
diff --git a/tests/phpunit/tests/functions/anonymization.php b/tests/phpunit/tests/functions/anonymization.php
index 231df96035..786b4cd238 100644
--- a/tests/phpunit/tests/functions/anonymization.php
+++ b/tests/phpunit/tests/functions/anonymization.php
@@ -36,7 +36,7 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase {
/* Todo test ipv6_fallback mode if keeping it.*/
- $this->assertEquals( $expected_result, $actual_result );
+ $this->assertSame( $expected_result, $actual_result );
}
/**
@@ -226,7 +226,7 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase {
* Test date anonymization of `wp_privacy_anonymize_data()`.
*/
public function test_anonymize_date() {
- $this->assertEquals( '0000-00-00 00:00:00', wp_privacy_anonymize_data( 'date', '2003-12-25 12:34:56' ) );
+ $this->assertSame( '0000-00-00 00:00:00', wp_privacy_anonymize_data( 'date', '2003-12-25 12:34:56' ) );
}
/**
@@ -234,7 +234,7 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase {
*/
public function test_anonymize_text() {
$text = __( 'Four score and seven years ago' );
- $this->assertEquals( '[deleted]', wp_privacy_anonymize_data( 'text', $text ) );
+ $this->assertSame( '[deleted]', wp_privacy_anonymize_data( 'text', $text ) );
}
/**
@@ -242,7 +242,7 @@ class Tests_Functions_Anonymization extends WP_UnitTestCase {
*/
public function test_anonymize_long_text() {
$text = __( 'Four score and seven years ago' );
- $this->assertEquals( 'This content was deleted by the author.', wp_privacy_anonymize_data( 'longtext', $text ) );
+ $this->assertSame( 'This content was deleted by the author.', wp_privacy_anonymize_data( 'longtext', $text ) );
}
/**
diff --git a/tests/phpunit/tests/functions/canonicalCharset.php b/tests/phpunit/tests/functions/canonicalCharset.php
index bd128b769e..ac89b1ec08 100644
--- a/tests/phpunit/tests/functions/canonicalCharset.php
+++ b/tests/phpunit/tests/functions/canonicalCharset.php
@@ -9,43 +9,43 @@
class Tests_Functions_CanonicalCharset extends WP_UnitTestCase {
public function test_utf_8_lower() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'utf-8' ) );
+ $this->assertSame( 'UTF-8', _canonical_charset( 'utf-8' ) );
}
public function test_utf_8_upper() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF-8' ) );
+ $this->assertSame( 'UTF-8', _canonical_charset( 'UTF-8' ) );
}
public function test_utf_8_mixxed() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'Utf-8' ) );
+ $this->assertSame( 'UTF-8', _canonical_charset( 'Utf-8' ) );
}
public function test_utf_8() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF8' ) );
+ $this->assertSame( 'UTF-8', _canonical_charset( 'UTF8' ) );
}
public function test_iso_lower() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'iso-8859-1' ) );
+ $this->assertSame( 'ISO-8859-1', _canonical_charset( 'iso-8859-1' ) );
}
public function test_iso_upper() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO-8859-1' ) );
+ $this->assertSame( 'ISO-8859-1', _canonical_charset( 'ISO-8859-1' ) );
}
public function test_iso_mixxed() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'Iso8859-1' ) );
+ $this->assertSame( 'ISO-8859-1', _canonical_charset( 'Iso8859-1' ) );
}
public function test_iso() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO8859-1' ) );
+ $this->assertSame( 'ISO-8859-1', _canonical_charset( 'ISO8859-1' ) );
}
public function test_random() {
- $this->assertEquals( 'random', _canonical_charset( 'random' ) );
+ $this->assertSame( 'random', _canonical_charset( 'random' ) );
}
public function test_empty() {
- $this->assertEquals( '', _canonical_charset( '' ) );
+ $this->assertSame( '', _canonical_charset( '' ) );
}
/**
@@ -55,32 +55,32 @@ class Tests_Functions_CanonicalCharset extends WP_UnitTestCase {
$orig_blog_charset = get_option( 'blog_charset' );
update_option( 'blog_charset', 'utf8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'utf-8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'UTF8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'UTF-8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+ $this->assertSame( 'UTF-8', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'ISO-8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'ISO8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'iso8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
update_option( 'blog_charset', 'iso-8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+ $this->assertSame( 'ISO-8859-1', get_option( 'blog_charset' ) );
// Arbitrary strings are passed through.
update_option( 'blog_charset', 'foobarbaz' );
- $this->assertEquals( 'foobarbaz', get_option( 'blog_charset' ) );
+ $this->assertSame( 'foobarbaz', get_option( 'blog_charset' ) );
update_option( 'blog_charset', $orig_blog_charset );
}
diff --git a/tests/phpunit/tests/functions/cleanupHeaderComment.php b/tests/phpunit/tests/functions/cleanupHeaderComment.php
index 9bc0d73cd5..d7557c8813 100644
--- a/tests/phpunit/tests/functions/cleanupHeaderComment.php
+++ b/tests/phpunit/tests/functions/cleanupHeaderComment.php
@@ -17,7 +17,7 @@ class Tests_Functions_CleanupHeaderComment extends WP_UnitTestCase {
* @param string $expected
*/
public function test_cleanup_header_comment( $test_string, $expected ) {
- $this->assertEqualsIgnoreEOL( $expected, _cleanup_header_comment( $test_string ) );
+ $this->assertSameIgnoreEOL( $expected, _cleanup_header_comment( $test_string ) );
}
/**
diff --git a/tests/phpunit/tests/functions/getWeekstartend.php b/tests/phpunit/tests/functions/getWeekstartend.php
index 978f49eee7..ee76275be6 100644
--- a/tests/phpunit/tests/functions/getWeekstartend.php
+++ b/tests/phpunit/tests/functions/getWeekstartend.php
@@ -11,7 +11,7 @@ class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
'end' => 1455494399,
);
- $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) );
+ $this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
}
public function test_start_of_week_sunday() {
@@ -20,7 +20,7 @@ class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
'end' => 1455407999,
);
- $this->assertEquals( $expected, get_weekstartend( '2016-02-12', 0 ) );
+ $this->assertSame( $expected, get_weekstartend( '2016-02-12', 0 ) );
}
public function test_start_of_week_should_fall_back_on_start_of_week_option() {
@@ -31,7 +31,7 @@ class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
'end' => 1455580799,
);
- $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) );
+ $this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
}
public function test_start_of_week_should_fall_back_on_sunday_when_option_is_missing() {
@@ -42,6 +42,6 @@ class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
'end' => 1455407999,
);
- $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) );
+ $this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
}
}
diff --git a/tests/phpunit/tests/functions/numberFormatI18n.php b/tests/phpunit/tests/functions/numberFormatI18n.php
index db10ff50a8..803b8ec02c 100644
--- a/tests/phpunit/tests/functions/numberFormatI18n.php
+++ b/tests/phpunit/tests/functions/numberFormatI18n.php
@@ -16,8 +16,8 @@ class Tests_Functions_NumberFormatI18n extends WP_UnitTestCase {
$GLOBALS['wp_locale'] = $locale;
- $this->assertEquals( '123,457', $actual_1 );
- $this->assertEquals( '123,456.7890', $actual_2 );
+ $this->assertSame( '123,457', $actual_1 );
+ $this->assertSame( '123,456.7890', $actual_2 );
}
public function test_should_respect_number_format_of_locale() {
@@ -33,17 +33,17 @@ class Tests_Functions_NumberFormatI18n extends WP_UnitTestCase {
$GLOBALS['wp_locale']->number_format['decimal_point'] = $decimal_point;
$GLOBALS['wp_locale']->number_format['thousands_sep'] = $thousands_sep;
- $this->assertEquals( '123^457', $actual_1 );
- $this->assertEquals( '123^456@7890', $actual_2 );
+ $this->assertSame( '123^457', $actual_1 );
+ $this->assertSame( '123^456@7890', $actual_2 );
}
public function test_should_default_to_en_us_format() {
- $this->assertEquals( '123,457', number_format_i18n( 123456.789, 0 ) );
- $this->assertEquals( '123,456.7890', number_format_i18n( 123456.789, 4 ) );
+ $this->assertSame( '123,457', number_format_i18n( 123456.789, 0 ) );
+ $this->assertSame( '123,456.7890', number_format_i18n( 123456.789, 4 ) );
}
public function test_should_handle_negative_precision() {
- $this->assertEquals( '123,457', number_format_i18n( 123456.789, 0 ) );
- $this->assertEquals( '123,456.7890', number_format_i18n( 123456.789, -4 ) );
+ $this->assertSame( '123,457', number_format_i18n( 123456.789, 0 ) );
+ $this->assertSame( '123,456.7890', number_format_i18n( 123456.789, -4 ) );
}
}
diff --git a/tests/phpunit/tests/functions/removeQueryArg.php b/tests/phpunit/tests/functions/removeQueryArg.php
index b55f903d98..3d53f881e0 100644
--- a/tests/phpunit/tests/functions/removeQueryArg.php
+++ b/tests/phpunit/tests/functions/removeQueryArg.php
@@ -11,7 +11,7 @@ class Tests_Functions_RemoveQueryArg extends WP_UnitTestCase {
$actual = remove_query_arg( $keys_to_remove, $url );
$this->assertNotEmpty( $actual );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
public function remove_query_arg_provider() {
diff --git a/tests/phpunit/tests/functions/wpGetArchives.php b/tests/phpunit/tests/functions/wpGetArchives.php
index 7eaf356b06..35d011921d 100644
--- a/tests/phpunit/tests/functions/wpGetArchives.php
+++ b/tests/phpunit/tests/functions/wpGetArchives.php
@@ -31,12 +31,12 @@ class Tests_Functions_wpGetArchives extends WP_UnitTestCase {
function test_wp_get_archives_default() {
$expected['default'] = "" . gmdate( 'F Y' ) . '';
- $this->assertEquals( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) );
+ $this->assertSame( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) );
}
function test_wp_get_archives_type() {
$expected['type'] = "" . gmdate( 'Y' ) . '';
- $this->assertEquals(
+ $this->assertSame(
$expected['type'],
trim(
wp_get_archives(
@@ -71,7 +71,7 @@ class Tests_Functions_wpGetArchives extends WP_UnitTestCase {
$title4
$title5
EOF;
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
$expected['limit'],
trim(
wp_get_archives(
@@ -87,7 +87,7 @@ EOF;
function test_wp_get_archives_format() {
$expected['format'] = "';
- $this->assertEquals(
+ $this->assertSame(
$expected['format'],
trim(
wp_get_archives(
@@ -102,7 +102,7 @@ EOF;
function test_wp_get_archives_before_and_after() {
$expected['before_and_after'] = "';
- $this->assertEquals(
+ $this->assertSame(
$expected['before_and_after'],
trim(
wp_get_archives(
@@ -119,7 +119,7 @@ EOF;
function test_wp_get_archives_show_post_count() {
$expected['show_post_count'] = "" . gmdate( 'F Y' ) . ' (8)';
- $this->assertEquals(
+ $this->assertSame(
$expected['show_post_count'],
trim(
wp_get_archives(
@@ -153,7 +153,7 @@ EOF;
October 2012
$date_full
EOF;
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
$expected['order_asc'],
trim(
wp_get_archives(
@@ -169,7 +169,7 @@ EOF;
$date_full
October 2012
EOF;
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
$expected['order_desc'],
trim(
wp_get_archives(
@@ -204,6 +204,6 @@ EOF;
'post_type' => 'taco',
)
);
- $this->assertEquals( $expected, trim( $archives ) );
+ $this->assertSame( $expected, trim( $archives ) );
}
}
diff --git a/tests/phpunit/tests/functions/wpListFilter.php b/tests/phpunit/tests/functions/wpListFilter.php
index 4708cea16f..e347308804 100644
--- a/tests/phpunit/tests/functions/wpListFilter.php
+++ b/tests/phpunit/tests/functions/wpListFilter.php
@@ -49,7 +49,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
),
'AND'
);
- $this->assertEquals( 2, count( $list ) );
+ $this->assertSame( 2, count( $list ) );
$this->assertArrayHasKey( 'foo', $list );
$this->assertArrayHasKey( 'bar', $list );
}
@@ -63,7 +63,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
),
'OR'
);
- $this->assertEquals( 3, count( $list ) );
+ $this->assertSame( 3, count( $list ) );
$this->assertArrayHasKey( 'foo', $list );
$this->assertArrayHasKey( 'bar', $list );
$this->assertArrayHasKey( 'baz', $list );
@@ -78,7 +78,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
),
'NOT'
);
- $this->assertEquals( 1, count( $list ) );
+ $this->assertSame( 1, count( $list ) );
$this->assertArrayHasKey( 'baz', $list );
}
@@ -92,7 +92,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
'AND',
'name'
);
- $this->assertEquals(
+ $this->assertSame(
array(
'foo' => 'foo',
'bar' => 'bar',
@@ -111,7 +111,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
'OR',
'name'
);
- $this->assertEquals(
+ $this->assertSame(
array(
'foo' => 'foo',
'bar' => 'bar',
@@ -130,12 +130,12 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
'NOT',
'name'
);
- $this->assertEquals( array( 'baz' => 'baz' ), $list );
+ $this->assertSame( array( 'baz' => 'baz' ), $list );
}
function test_wp_list_pluck() {
$list = wp_list_pluck( $this->object_list, 'name' );
- $this->assertEquals(
+ $this->assertSame(
array(
'foo' => 'foo',
'bar' => 'bar',
@@ -145,7 +145,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
);
$list = wp_list_pluck( $this->array_list, 'name' );
- $this->assertEquals(
+ $this->assertSame(
array(
'foo' => 'foo',
'bar' => 'bar',
@@ -160,7 +160,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
*/
function test_wp_list_pluck_index_key() {
$list = wp_list_pluck( $this->array_list, 'name', 'id' );
- $this->assertEquals(
+ $this->assertSame(
array(
'f' => 'foo',
'b' => 'bar',
@@ -175,7 +175,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
*/
function test_wp_list_pluck_object_index_key() {
$list = wp_list_pluck( $this->object_list, 'name', 'id' );
- $this->assertEquals(
+ $this->assertSame(
array(
'f' => 'foo',
'b' => 'bar',
@@ -190,7 +190,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
*/
function test_wp_list_pluck_missing_index_key() {
$list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' );
- $this->assertEquals(
+ $this->assertSame(
array(
0 => 'foo',
1 => 'bar',
@@ -207,7 +207,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
$array_list = $this->array_list;
unset( $array_list['bar']['id'] );
$list = wp_list_pluck( $array_list, 'name', 'id' );
- $this->assertEquals(
+ $this->assertSame(
array(
'f' => 'foo',
0 => 'bar',
@@ -224,7 +224,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
$mixed_list = $this->array_list;
$mixed_list['bar'] = (object) $mixed_list['bar'];
$list = wp_list_pluck( $mixed_list, 'name', 'id' );
- $this->assertEquals(
+ $this->assertSame(
array(
'f' => 'foo',
'b' => 'bar',
@@ -247,7 +247,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
$this->assertInstanceOf( 'stdClass', $ref_list[1] );
$list = wp_list_pluck( $ref_list, 'name' );
- $this->assertEquals(
+ $this->assertSame(
array(
'foo',
'bar',
@@ -272,7 +272,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
$this->assertInstanceOf( 'stdClass', $ref_list[1] );
$list = wp_list_pluck( $ref_list, 'name', 'id' );
- $this->assertEquals(
+ $this->assertSame(
array(
'f' => 'foo',
'b' => 'bar',
@@ -286,13 +286,13 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
function test_filter_object_list_nested_array_and() {
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
- $this->assertEquals( 1, count( $list ) );
+ $this->assertSame( 1, count( $list ) );
$this->assertArrayHasKey( 'baz', $list );
}
function test_filter_object_list_nested_array_not() {
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
- $this->assertEquals( 2, count( $list ) );
+ $this->assertSame( 2, count( $list ) );
$this->assertArrayHasKey( 'bar', $list );
$this->assertArrayHasKey( 'baz', $list );
}
@@ -306,26 +306,26 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
),
'OR'
);
- $this->assertEquals( 2, count( $list ) );
+ $this->assertSame( 2, count( $list ) );
$this->assertArrayHasKey( 'foo', $list );
$this->assertArrayHasKey( 'baz', $list );
}
function test_filter_object_list_nested_array_or_singular() {
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
- $this->assertEquals( 1, count( $list ) );
+ $this->assertSame( 1, count( $list ) );
$this->assertArrayHasKey( 'baz', $list );
}
function test_filter_object_list_nested_array_and_field() {
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' );
- $this->assertEquals( array( 'baz' => 'baz' ), $list );
+ $this->assertSame( array( 'baz' => 'baz' ), $list );
}
function test_filter_object_list_nested_array_not_field() {
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' );
- $this->assertEquals(
+ $this->assertSame(
array(
'foo' => 'foo',
'baz' => 'baz',
@@ -344,7 +344,7 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
'OR',
'name'
);
- $this->assertEquals(
+ $this->assertSame(
array(
'foo' => 'foo',
'baz' => 'baz',
diff --git a/tests/phpunit/tests/functions/wpListUtil.php b/tests/phpunit/tests/functions/wpListUtil.php
index d6a014357c..6368b87d05 100644
--- a/tests/phpunit/tests/functions/wpListUtil.php
+++ b/tests/phpunit/tests/functions/wpListUtil.php
@@ -691,7 +691,7 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase {
* @param string $order Either 'ASC' or 'DESC'.
*/
public function test_wp_list_sort( $list, $orderby, $order, $expected ) {
- $this->assertEquals( $expected, wp_list_sort( $list, $orderby, $order ) );
+ $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order ) );
}
public function data_test_wp_list_sort_preserve_keys() {
@@ -1016,7 +1016,7 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase {
* @param string $order Either 'ASC' or 'DESC'.
*/
public function test_wp_list_sort_preserve_keys( $list, $orderby, $order, $expected ) {
- $this->assertEquals( $expected, wp_list_sort( $list, $orderby, $order, true ) );
+ $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order, true ) );
}
public function test_wp_list_util_get_input() {
diff --git a/tests/phpunit/tests/functions/wpRemoteFopen.php b/tests/phpunit/tests/functions/wpRemoteFopen.php
index 3d52b82ba1..ce3d8f37dd 100644
--- a/tests/phpunit/tests/functions/wpRemoteFopen.php
+++ b/tests/phpunit/tests/functions/wpRemoteFopen.php
@@ -29,6 +29,6 @@ class Tests_Functions_wpRemoteFopen extends WP_UnitTestCase {
$response = wp_remote_fopen( $url );
$this->assertInternalType( 'string', $response );
- $this->assertEquals( 40148, strlen( $response ) );
+ $this->assertSame( 40148, strlen( $response ) );
}
}
diff --git a/tests/phpunit/tests/general/archives.php b/tests/phpunit/tests/general/archives.php
index f32bb6bcbc..88cfbd8311 100644
--- a/tests/phpunit/tests/general/archives.php
+++ b/tests/phpunit/tests/general/archives.php
@@ -32,7 +32,7 @@ class Tests_General_Archives extends WP_UnitTestCase {
$this->assertInternalType( 'string', $result );
$time1 = wp_cache_get( 'last_changed', 'posts' );
$this->assertNotEmpty( $time1 );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -44,8 +44,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
// Change args, resulting in a different query string. Cache is not primed, expect 1 query.
$result = wp_get_archives(
@@ -56,8 +56,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -70,8 +70,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -83,8 +83,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -96,8 +96,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
// Change type. Cache is not primed, expect 1 query.
$result = wp_get_archives(
@@ -107,8 +107,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -120,8 +120,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
// Change type. Cache is not primed, expect 1 query.
$result = wp_get_archives(
@@ -131,8 +131,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -144,8 +144,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
// Change type. Cache is not primed, expect 1 query.
$result = wp_get_archives(
@@ -155,8 +155,8 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
$num_queries = $wpdb->num_queries;
@@ -168,7 +168,7 @@ class Tests_General_Archives extends WP_UnitTestCase {
)
);
$this->assertInternalType( 'string', $result );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
}
}
diff --git a/tests/phpunit/tests/general/document-title.php b/tests/phpunit/tests/general/document-title.php
index 826a14a7cd..a15f926ea9 100644
--- a/tests/phpunit/tests/general/document-title.php
+++ b/tests/phpunit/tests/general/document-title.php
@@ -80,7 +80,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'pre_get_document_title', array( $this, '_short_circuit_title' ) );
- $this->assertEquals( 'A Wild Title', wp_get_document_title() );
+ $this->assertSame( 'A Wild Title', wp_get_document_title() );
}
function _short_circuit_title( $title ) {
@@ -101,12 +101,12 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'document_title_parts', array( $this, '_front_page_title_parts' ) );
$this->go_to( '/' );
- $this->assertEquals( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() );
update_option( 'show_on_front', 'posts' );
$this->go_to( '/' );
- $this->assertEquals( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() );
}
function _front_page_title_parts( $parts ) {
@@ -129,7 +129,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
// Show page name on home page if it's not the front page.
$this->go_to( get_permalink( $blog_page_id ) );
- $this->assertEquals( sprintf( 'blog-page – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'blog-page – %s', $this->blog_name ), wp_get_document_title() );
}
function test_paged_title() {
@@ -137,7 +137,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'document_title_parts', array( $this, '_paged_title_parts' ) );
- $this->assertEquals( sprintf( '%s – Page 4 – Just another WordPress site', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( '%s – Page 4 – Just another WordPress site', $this->blog_name ), wp_get_document_title() );
}
function _paged_title_parts( $parts ) {
@@ -154,7 +154,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'document_title_parts', array( $this, '_singular_title_parts' ) );
- $this->assertEquals( sprintf( 'test_title – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'test_title – %s', $this->blog_name ), wp_get_document_title() );
}
function _singular_title_parts( $parts ) {
@@ -168,19 +168,19 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
function test_category_title() {
$this->go_to( '?cat=' . self::$category_id );
- $this->assertEquals( sprintf( 'test_category – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'test_category – %s', $this->blog_name ), wp_get_document_title() );
}
function test_search_title() {
$this->go_to( '?s=test_title' );
- $this->assertEquals( sprintf( 'Search Results for “test_title” – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'Search Results for “test_title” – %s', $this->blog_name ), wp_get_document_title() );
}
function test_author_title() {
$this->go_to( '?author=' . self::$author_id );
- $this->assertEquals( sprintf( 'test_author – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'test_author – %s', $this->blog_name ), wp_get_document_title() );
}
function test_post_type_archive_title() {
@@ -203,31 +203,31 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
$this->go_to( '?post_type=cpt' );
- $this->assertEquals( sprintf( 'test_cpt – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'test_cpt – %s', $this->blog_name ), wp_get_document_title() );
}
function test_year_title() {
$this->go_to( '?year=2015' );
- $this->assertEquals( sprintf( '2015 – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( '2015 – %s', $this->blog_name ), wp_get_document_title() );
}
function test_month_title() {
$this->go_to( '?monthnum=09' );
- $this->assertEquals( sprintf( 'September 2015 – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'September 2015 – %s', $this->blog_name ), wp_get_document_title() );
}
function test_day_title() {
$this->go_to( '?day=22' );
- $this->assertEquals( sprintf( 'September 22, 2015 – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'September 22, 2015 – %s', $this->blog_name ), wp_get_document_title() );
}
function test_404_title() {
$this->go_to( '?m=404' );
- $this->assertEquals( sprintf( 'Page not found – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'Page not found – %s', $this->blog_name ), wp_get_document_title() );
}
function test_paged_post_title() {
@@ -235,7 +235,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'title_tag_parts', array( $this, '_paged_post_title_parts' ) );
- $this->assertEquals( sprintf( 'test_title – Page 4 – %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'test_title – Page 4 – %s', $this->blog_name ), wp_get_document_title() );
}
function _paged_post_title_parts( $parts ) {
@@ -252,7 +252,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'document_title_parts', array( $this, '_rearrange_title_parts' ) );
- $this->assertEquals( sprintf( '%s – test_title', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( '%s – test_title', $this->blog_name ), wp_get_document_title() );
}
function _rearrange_title_parts( $parts ) {
@@ -269,7 +269,7 @@ class Tests_General_DocumentTitle extends WP_UnitTestCase {
add_filter( 'document_title_separator', array( $this, '_change_title_separator' ) );
- $this->assertEquals( sprintf( 'test_title %%%% %s', $this->blog_name ), wp_get_document_title() );
+ $this->assertSame( sprintf( 'test_title %%%% %s', $this->blog_name ), wp_get_document_title() );
}
function _change_title_separator( $sep ) {
diff --git a/tests/phpunit/tests/general/paginateLinks.php b/tests/phpunit/tests/general/paginateLinks.php
index 95692a0524..be6ce5b2ea 100644
--- a/tests/phpunit/tests/general/paginateLinks.php
+++ b/tests/phpunit/tests/general/paginateLinks.php
@@ -25,7 +25,7 @@ class Tests_Paginate_Links extends WP_UnitTestCase {
EXPECTED;
$links = paginate_links( array( 'total' => 50 ) );
- $this->assertEqualsIgnoreEOL( $expected, $links );
+ $this->assertSameIgnoreEOL( $expected, $links );
}
function test_format() {
@@ -48,7 +48,7 @@ EXPECTED;
'format' => 'page/%#%/',
)
);
- $this->assertEqualsIgnoreEOL( $expected, $links );
+ $this->assertSameIgnoreEOL( $expected, $links );
}
function test_prev_next_false() {
@@ -73,7 +73,7 @@ EXPECTED;
'current' => 2,
)
);
- $this->assertEqualsIgnoreEOL( $expected, $links );
+ $this->assertSameIgnoreEOL( $expected, $links );
}
function test_prev_next_true() {
@@ -100,7 +100,7 @@ EXPECTED;
'current' => 2,
)
);
- $this->assertEqualsIgnoreEOL( $expected, $links );
+ $this->assertSameIgnoreEOL( $expected, $links );
}
function increment_i18n_count() {
@@ -125,7 +125,7 @@ EXPECTED;
);
// The links should be:
// < Previous 1 ... 49 50 51 ... 100 Next >
- $this->assertEquals( 5, $this->i18n_count );
+ $this->assertSame( 5, $this->i18n_count );
remove_filter( 'number_format_i18n', array( $this, 'increment_i18n_count' ) );
}
@@ -170,8 +170,8 @@ EXPECTED;
$href = $tag->attributes->getNamedItem( 'href' )->value;
$class = $tag->attributes->getNamedItem( 'class' )->value;
- $this->assertEquals( $attributes['href'], $href );
- $this->assertEquals( $attributes['class'], $class );
+ $this->assertSame( $attributes['href'], $href );
+ $this->assertSame( $attributes['class'], $class );
}
// Current page: 1.
@@ -190,14 +190,14 @@ EXPECTED;
$this->assertNotNull( $tag );
$class = $tag->attributes->getNamedItem( 'class' )->value;
- $this->assertEquals( 'page-numbers current', $class );
+ $this->assertSame( 'page-numbers current', $class );
$document->loadHTML( $links[1] );
$tag = $document->getElementsByTagName( 'a' )->item( 0 );
$this->assertNotNull( $tag );
$href = $tag->attributes->getNamedItem( 'href' )->value;
- $this->assertEquals( get_pagenum_link( 2 ), $href );
+ $this->assertSame( get_pagenum_link( 2 ), $href );
}
function add_query_arg( $url ) {
@@ -244,7 +244,7 @@ EXPECTED;
$this->assertNotNull( $tag );
$href = $tag->attributes->getNamedItem( 'href' )->value;
- $this->assertEquals( $expected_href, $href );
+ $this->assertSame( $expected_href, $href );
}
}
@@ -284,7 +284,7 @@ EXPECTED;
$this->assertNotNull( $tag );
$href = $tag->attributes->getNamedItem( 'href' )->value;
- $this->assertEquals( $expected_href, $href );
+ $this->assertSame( $expected_href, $href );
}
}
diff --git a/tests/phpunit/tests/general/resourceHints.php b/tests/phpunit/tests/general/resourceHints.php
index 624256f54c..d3d10cbecb 100644
--- a/tests/phpunit/tests/general/resourceHints.php
+++ b/tests/phpunit/tests/general/resourceHints.php
@@ -50,7 +50,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
remove_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function _add_dns_prefetch_domains( $hints, $method ) {
@@ -82,7 +82,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
remove_filter( 'wp_resource_hints', array( $this, '_add_preconnect_domains' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function _add_preconnect_domains( $hints, $method ) {
@@ -109,7 +109,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
remove_filter( 'wp_resource_hints', array( $this, '_add_prerender_urls' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function _add_prerender_urls( $hints, $method ) {
@@ -133,7 +133,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
remove_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function _add_dns_prefetch_long_urls( $hints, $method ) {
@@ -159,7 +159,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
wp_dequeue_style( 'googlefonts' );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
@@ -178,7 +178,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
wp_dequeue_style( 'googlefonts' );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function test_dns_prefetch_scripts_does_not_included_registered_only() {
@@ -191,7 +191,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
wp_deregister_script( 'jquery-elsewhere' );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
$this->assertNotContains( $unexpected, $actual );
}
@@ -205,7 +205,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
wp_deregister_script( 'test-script' );
$actual = get_echo( 'wp_resource_hints' );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
/**
@@ -218,13 +218,13 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
add_filter( 'wp_resource_hints', array( $this, '_add_malformed_url_errant_colon' ), 10, 2 );
$actual = get_echo( 'wp_resource_hints' );
remove_filter( 'wp_resource_hints', array( $this, '_add_malformed_url_errant_colon' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
// Unsupported Scheme.
add_filter( 'wp_resource_hints', array( $this, '_add_malformed_url_unsupported_scheme' ), 10, 2 );
$actual = get_echo( 'wp_resource_hints' );
remove_filter( 'wp_resource_hints', array( $this, '_add_malformed_url_unsupported_scheme' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function _add_malformed_url_errant_colon( $hints, $method ) {
@@ -259,7 +259,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
remove_filter( 'wp_resource_hints', array( $this, '_add_url_with_attributes' ) );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function _add_url_with_attributes( $hints, $method ) {
diff --git a/tests/phpunit/tests/general/template.php b/tests/phpunit/tests/general/template.php
index e6c3d104f9..096cf8bce8 100644
--- a/tests/phpunit/tests/general/template.php
+++ b/tests/phpunit/tests/general/template.php
@@ -38,7 +38,7 @@ class Tests_General_Template extends WP_UnitTestCase {
$this->assertEmpty( get_site_icon_url() );
$this->_set_site_icon();
- $this->assertEquals( $this->site_icon_url, get_site_icon_url() );
+ $this->assertSame( $this->site_icon_url, get_site_icon_url() );
$this->_remove_site_icon();
$this->assertEmpty( get_site_icon_url() );
@@ -323,7 +323,7 @@ class Tests_General_Template extends WP_UnitTestCase {
restore_current_blog();
$expected_custom_logo = '' . $image . '';
- $this->assertEquals( $expected_custom_logo, get_custom_logo( $blog_id ) );
+ $this->assertSame( $expected_custom_logo, get_custom_logo( $blog_id ) );
}
/**
@@ -554,8 +554,8 @@ class Tests_General_Template extends WP_UnitTestCase {
* @dataProvider data_selected_and_checked_with_equal_values
*/
function test_selected_and_checked_with_equal_values( $selected, $current ) {
- $this->assertEquals( " selected='selected'", selected( $selected, $current, false ) );
- $this->assertEquals( " checked='checked'", checked( $selected, $current, false ) );
+ $this->assertSame( " selected='selected'", selected( $selected, $current, false ) );
+ $this->assertSame( " checked='checked'", checked( $selected, $current, false ) );
}
function data_selected_and_checked_with_equal_values() {
@@ -578,8 +578,8 @@ class Tests_General_Template extends WP_UnitTestCase {
* @dataProvider data_selected_and_checked_with_non_equal_values
*/
function test_selected_and_checked_with_non_equal_values( $selected, $current ) {
- $this->assertEquals( '', selected( $selected, $current, false ) );
- $this->assertEquals( '', checked( $selected, $current, false ) );
+ $this->assertSame( '', selected( $selected, $current, false ) );
+ $this->assertSame( '', checked( $selected, $current, false ) );
}
function data_selected_and_checked_with_non_equal_values() {
diff --git a/tests/phpunit/tests/general/wpError.php b/tests/phpunit/tests/general/wpError.php
index 72a575fbf7..1a7e36c1d8 100644
--- a/tests/phpunit/tests/general/wpError.php
+++ b/tests/phpunit/tests/general/wpError.php
@@ -60,7 +60,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
public function test_WP_Error_with_code_and_empty_message_and_empty_data_should_add_error_but_not_associated_data() {
$wp_error = new WP_Error( 'code' );
- $this->assertSame( null, $wp_error->get_error_data( 'code' ) );
+ $this->assertNull( $wp_error->get_error_data( 'code' ) );
}
public function test_WP_Error_with_code_and_empty_message_and_non_empty_data_should_add_error_with_empty_message_and_that_stored_data() {
@@ -272,7 +272,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
* @covers ::get_error_data
*/
public function test_get_error_data_with_empty_code_and_no_errors_should_evaluate_as_null() {
- $this->assertSame( null, $this->wp_error->get_error_data() );
+ $this->assertNull( $this->wp_error->get_error_data() );
}
/**
@@ -281,7 +281,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
public function test_get_error_data_with_empty_code_one_error_no_data_should_evaluate_as_null() {
$this->wp_error->add( 'code', 'message' );
- $this->assertSame( null, $this->wp_error->get_error_data() );
+ $this->assertNull( $this->wp_error->get_error_data() );
}
/**
@@ -291,7 +291,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
$this->wp_error->add( 'code', 'message' );
$this->wp_error->add( 'code2', 'message2' );
- $this->assertSame( null, $this->wp_error->get_error_data() );
+ $this->assertNull( $this->wp_error->get_error_data() );
}
/**
@@ -330,7 +330,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
* @covers ::get_error_data
*/
public function test_get_error_data_with_code_and_no_errors_should_evaluate_as_null() {
- $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) );
+ $this->assertNull( $this->wp_error->get_error_data( 'code' ) );
}
/**
@@ -339,7 +339,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
public function test_get_error_data_with_code_and_one_error_with_no_data_should_evaluate_as_null() {
$this->wp_error->add( 'code', 'message' );
- $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) );
+ $this->assertNull( $this->wp_error->get_error_data( 'code' ) );
}
/**
@@ -450,7 +450,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
public function test_add_with_code_empty_message_empty_data_should_not_add_error_data() {
$this->wp_error->add( 'code', '' );
- $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) );
+ $this->assertNull( $this->wp_error->get_error_data( 'code' ) );
}
/**
@@ -468,7 +468,7 @@ class Tests_WP_Error extends WP_UnitTestCase {
public function test_add_with_code_and_message_and_empty_data_should_not_alter_stored_data() {
$this->wp_error->add( 'code', 'message' );
- $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) );
+ $this->assertNull( $this->wp_error->get_error_data( 'code' ) );
}
/**
diff --git a/tests/phpunit/tests/hooks/addFilter.php b/tests/phpunit/tests/hooks/addFilter.php
index 5e9c0e75e3..2c134ef333 100644
--- a/tests/phpunit/tests/hooks/addFilter.php
+++ b/tests/phpunit/tests/hooks/addFilter.php
@@ -20,8 +20,8 @@ class Tests_WP_Hook_Add_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
$function_index = _wp_filter_build_unique_id( $tag, $callback, $priority );
- $this->assertEquals( $callback, $hook->callbacks[ $priority ][ $function_index ]['function'] );
- $this->assertEquals( $accepted_args, $hook->callbacks[ $priority ][ $function_index ]['accepted_args'] );
+ $this->assertSame( $callback, $hook->callbacks[ $priority ][ $function_index ]['function'] );
+ $this->assertSame( $accepted_args, $hook->callbacks[ $priority ][ $function_index ]['accepted_args'] );
}
public function test_add_filter_with_object() {
@@ -35,8 +35,8 @@ class Tests_WP_Hook_Add_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
$function_index = _wp_filter_build_unique_id( $tag, $callback, $priority );
- $this->assertEquals( $callback, $hook->callbacks[ $priority ][ $function_index ]['function'] );
- $this->assertEquals( $accepted_args, $hook->callbacks[ $priority ][ $function_index ]['accepted_args'] );
+ $this->assertSame( $callback, $hook->callbacks[ $priority ][ $function_index ]['function'] );
+ $this->assertSame( $accepted_args, $hook->callbacks[ $priority ][ $function_index ]['accepted_args'] );
}
public function test_add_filter_with_static_method() {
@@ -49,8 +49,8 @@ class Tests_WP_Hook_Add_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
$function_index = _wp_filter_build_unique_id( $tag, $callback, $priority );
- $this->assertEquals( $callback, $hook->callbacks[ $priority ][ $function_index ]['function'] );
- $this->assertEquals( $accepted_args, $hook->callbacks[ $priority ][ $function_index ]['accepted_args'] );
+ $this->assertSame( $callback, $hook->callbacks[ $priority ][ $function_index ]['function'] );
+ $this->assertSame( $accepted_args, $hook->callbacks[ $priority ][ $function_index ]['accepted_args'] );
}
public function test_add_two_filters_with_same_priority() {
@@ -124,7 +124,7 @@ class Tests_WP_Hook_Add_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, array( $b, 'action' ), 5, 1 );
$hook->add_filter( $tag, array( $c, 'action' ), 8, 1 );
- $this->assertEquals( array( 5, 8, 10 ), array_keys( $hook->callbacks ) );
+ $this->assertSame( array( 5, 8, 10 ), array_keys( $hook->callbacks ) );
}
public function test_remove_and_add() {
diff --git a/tests/phpunit/tests/hooks/applyFilters.php b/tests/phpunit/tests/hooks/applyFilters.php
index 1879cbf70b..a50f21bf38 100644
--- a/tests/phpunit/tests/hooks/applyFilters.php
+++ b/tests/phpunit/tests/hooks/applyFilters.php
@@ -20,8 +20,8 @@ class Tests_WP_Hook_Apply_Filters extends WP_UnitTestCase {
$returned = $hook->apply_filters( $arg, array( $arg ) );
- $this->assertEquals( $returned, $arg );
- $this->assertEquals( 1, $a->get_call_count() );
+ $this->assertSame( $returned, $arg );
+ $this->assertSame( 1, $a->get_call_count() );
}
public function test_apply_filters_with_multiple_calls() {
@@ -38,8 +38,8 @@ class Tests_WP_Hook_Apply_Filters extends WP_UnitTestCase {
$returned_one = $hook->apply_filters( $arg, array( $arg ) );
$returned_two = $hook->apply_filters( $returned_one, array( $returned_one ) );
- $this->assertEquals( $returned_two, $arg );
- $this->assertEquals( 2, $a->get_call_count() );
+ $this->assertSame( $returned_two, $arg );
+ $this->assertSame( 2, $a->get_call_count() );
}
}
diff --git a/tests/phpunit/tests/hooks/doAction.php b/tests/phpunit/tests/hooks/doAction.php
index 34f90eae3a..542edf14ac 100644
--- a/tests/phpunit/tests/hooks/doAction.php
+++ b/tests/phpunit/tests/hooks/doAction.php
@@ -27,7 +27,7 @@ class Tests_WP_Hook_Do_Action extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
$hook->do_action( array( $arg ) );
- $this->assertEquals( 1, $a->get_call_count() );
+ $this->assertSame( 1, $a->get_call_count() );
}
public function test_do_action_with_multiple_calls() {
@@ -43,7 +43,7 @@ class Tests_WP_Hook_Do_Action extends WP_UnitTestCase {
$hook->do_action( array( $arg ) );
$hook->do_action( array( $arg ) );
- $this->assertEquals( 2, $a->get_call_count() );
+ $this->assertSame( 2, $a->get_call_count() );
}
public function test_do_action_with_multiple_callbacks_on_same_priority() {
@@ -61,8 +61,8 @@ class Tests_WP_Hook_Do_Action extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback_two, $priority, $accepted_args );
$hook->do_action( array( $arg ) );
- $this->assertEquals( 1, $a->get_call_count() );
- $this->assertEquals( 1, $a->get_call_count() );
+ $this->assertSame( 1, $a->get_call_count() );
+ $this->assertSame( 1, $a->get_call_count() );
}
public function test_do_action_with_multiple_callbacks_on_different_priorities() {
@@ -80,8 +80,8 @@ class Tests_WP_Hook_Do_Action extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
$hook->do_action( array( $arg ) );
- $this->assertEquals( 1, $a->get_call_count() );
- $this->assertEquals( 1, $a->get_call_count() );
+ $this->assertSame( 1, $a->get_call_count() );
+ $this->assertSame( 1, $a->get_call_count() );
}
public function test_do_action_with_no_accepted_args() {
diff --git a/tests/phpunit/tests/hooks/doAllHook.php b/tests/phpunit/tests/hooks/doAllHook.php
index abaf92525b..d848b5ab16 100644
--- a/tests/phpunit/tests/hooks/doAllHook.php
+++ b/tests/phpunit/tests/hooks/doAllHook.php
@@ -21,6 +21,6 @@ class Tests_WP_Hook_Do_All_Hook extends WP_UnitTestCase {
$hook->do_all_hook( $args );
$hook->do_all_hook( $args );
- $this->assertEquals( 2, $a->get_call_count() );
+ $this->assertSame( 2, $a->get_call_count() );
}
}
diff --git a/tests/phpunit/tests/hooks/hasFilter.php b/tests/phpunit/tests/hooks/hasFilter.php
index 61b79861c3..bf63ee6e06 100644
--- a/tests/phpunit/tests/hooks/hasFilter.php
+++ b/tests/phpunit/tests/hooks/hasFilter.php
@@ -16,7 +16,7 @@ class Tests_WP_Hook_Has_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
- $this->assertEquals( $priority, $hook->has_filter( $tag, $callback ) );
+ $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
}
public function test_has_filter_with_object() {
@@ -29,7 +29,7 @@ class Tests_WP_Hook_Has_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
- $this->assertEquals( $priority, $hook->has_filter( $tag, $callback ) );
+ $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
}
public function test_has_filter_with_static_method() {
@@ -41,7 +41,7 @@ class Tests_WP_Hook_Has_Filter extends WP_UnitTestCase {
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
- $this->assertEquals( $priority, $hook->has_filter( $tag, $callback ) );
+ $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
}
public function test_has_filter_without_callback() {
diff --git a/tests/phpunit/tests/hooks/preinitHooks.php b/tests/phpunit/tests/hooks/preinitHooks.php
index 8211a16b3b..7eb5efe5cc 100644
--- a/tests/phpunit/tests/hooks/preinitHooks.php
+++ b/tests/phpunit/tests/hooks/preinitHooks.php
@@ -33,7 +33,7 @@ class Tests_WP_Hook_Preinit_Hooks extends WP_UnitTestCase {
$hooks = WP_Hook::build_preinitialized_hooks( $filters );
- $this->assertEquals( $priority1, $hooks[ $tag1 ]->has_filter( $tag1, '__return_false' ) );
- $this->assertEquals( $priority2, $hooks[ $tag2 ]->has_filter( $tag2, '__return_null' ) );
+ $this->assertSame( $priority1, $hooks[ $tag1 ]->has_filter( $tag1, '__return_false' ) );
+ $this->assertSame( $priority2, $hooks[ $tag2 ]->has_filter( $tag2, '__return_null' ) );
}
}
diff --git a/tests/phpunit/tests/hooks/removeAllFilters.php b/tests/phpunit/tests/hooks/removeAllFilters.php
index 9a0f013d0f..1437c57248 100644
--- a/tests/phpunit/tests/hooks/removeAllFilters.php
+++ b/tests/phpunit/tests/hooks/removeAllFilters.php
@@ -36,6 +36,6 @@ class Tests_WP_Hook_Remove_All_Filters extends WP_UnitTestCase {
$this->assertFalse( $hook->has_filter( $tag, $callback_one ) );
$this->assertTrue( $hook->has_filters() );
- $this->assertEquals( $priority + 1, $hook->has_filter( $tag, $callback_two ) );
+ $this->assertSame( $priority + 1, $hook->has_filter( $tag, $callback_two ) );
}
}
diff --git a/tests/phpunit/tests/http/base.php b/tests/phpunit/tests/http/base.php
index d438056126..fdc78ffe3c 100644
--- a/tests/phpunit/tests/http/base.php
+++ b/tests/phpunit/tests/http/base.php
@@ -57,7 +57,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 200, (int) $res['response']['code'] );
+ $this->assertSame( 200, (int) $res['response']['code'] );
}
function test_redirect_on_302() {
@@ -66,7 +66,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 200, (int) $res['response']['code'] );
+ $this->assertSame( 200, (int) $res['response']['code'] );
}
/**
@@ -78,7 +78,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 301, (int) $res['response']['code'] );
+ $this->assertSame( 301, (int) $res['response']['code'] );
}
/**
@@ -90,7 +90,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 302, (int) $res['response']['code'] );
+ $this->assertSame( 302, (int) $res['response']['code'] );
}
function test_redirections_equal() {
@@ -99,7 +99,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 200, (int) $res['response']['code'] );
+ $this->assertSame( 200, (int) $res['response']['code'] );
}
function test_no_head_redirections() {
@@ -108,7 +108,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 302, (int) $res['response']['code'] );
+ $this->assertSame( 302, (int) $res['response']['code'] );
}
/**
@@ -126,7 +126,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 200, (int) $res['response']['code'] );
+ $this->assertSame( 200, (int) $res['response']['code'] );
}
function test_redirections_greater() {
@@ -162,7 +162,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 302, (int) $res['response']['code'] );
+ $this->assertSame( 302, (int) $res['response']['code'] );
}
/**
@@ -176,7 +176,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( 'PASS', $res['body'] );
+ $this->assertSame( 'PASS', $res['body'] );
}
/**
@@ -197,7 +197,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
);
$this->skipTestOnTimeout( $res );
- $this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+ $this->assertSame( 'PASS', wp_remote_retrieve_body( $res ) );
$this->assertTrue( ! empty( $res['headers']['location'] ) );
}
@@ -252,9 +252,9 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( '', $res['body'] ); // The body should be empty.
+ $this->assertSame( '', $res['body'] ); // The body should be empty.
$this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same).
- $this->assertEquals( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters.
+ $this->assertSame( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters.
$this->assertStringStartsWith( get_temp_dir(), $res['filename'] ); // Check it's saving within the temp directory.
}
@@ -281,7 +281,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters.
+ $this->assertSame( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters.
}
@@ -304,7 +304,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
- $this->assertEquals( $size, strlen( $res['body'] ) );
+ $this->assertSame( $size, strlen( $res['body'] ) );
}
/**
@@ -320,7 +320,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$res = wp_remote_post( add_query_arg( 'response_code', $response_code, $url ), array( 'timeout' => 30 ) );
$this->skipTestOnTimeout( $res );
- $this->assertEquals( $method, wp_remote_retrieve_body( $res ) );
+ $this->assertSame( $method, wp_remote_retrieve_body( $res ) );
}
public function data_post_redirect_to_method_300() {
@@ -367,7 +367,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$res = wp_remote_get( $url, $args );
$this->skipTestOnTimeout( $res );
- $this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+ $this->assertSame( 'PASS', wp_remote_retrieve_body( $res ) );
}
@@ -409,7 +409,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$res = wp_remote_get( $url, array( 'timeout' => 30 ) );
$this->skipTestOnTimeout( $res );
- $this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+ $this->assertSame( 'PASS', wp_remote_retrieve_body( $res ) );
}
@@ -424,7 +424,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$res = wp_remote_get( $url );
$this->skipTestOnTimeout( $res );
- $this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+ $this->assertSame( 'PASS', wp_remote_retrieve_body( $res ) );
}
/**
diff --git a/tests/phpunit/tests/http/functions.php b/tests/phpunit/tests/http/functions.php
index de272d9a0e..d28936fde6 100644
--- a/tests/phpunit/tests/http/functions.php
+++ b/tests/phpunit/tests/http/functions.php
@@ -25,9 +25,9 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$this->assertInternalType( 'array', $response );
- $this->assertEquals( 'image/jpeg', $headers['content-type'] );
- $this->assertEquals( '40148', $headers['content-length'] );
- $this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
+ $this->assertSame( 'image/jpeg', $headers['content-type'] );
+ $this->assertSame( '40148', $headers['content-length'] );
+ $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
}
function test_head_redirect() {
@@ -36,7 +36,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$response = wp_remote_head( $url );
$this->skipTestOnTimeout( $response );
- $this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
+ $this->assertSame( 301, wp_remote_retrieve_response_code( $response ) );
}
function test_head_404() {
@@ -44,7 +44,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$response = wp_remote_head( $url );
$this->skipTestOnTimeout( $response );
- $this->assertEquals( '404', wp_remote_retrieve_response_code( $response ) );
+ $this->assertSame( 404, wp_remote_retrieve_response_code( $response ) );
}
function test_get_request() {
@@ -59,9 +59,9 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$this->assertInternalType( 'array', $response );
// Should return the same headers as a HEAD request.
- $this->assertEquals( 'image/jpeg', $headers['content-type'] );
- $this->assertEquals( '40148', $headers['content-length'] );
- $this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
+ $this->assertSame( 'image/jpeg', $headers['content-type'] );
+ $this->assertSame( '40148', $headers['content-length'] );
+ $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
}
function test_get_redirect() {
@@ -75,9 +75,9 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$headers = wp_remote_retrieve_headers( $response );
// Should return the same headers as a HEAD request.
- $this->assertEquals( 'image/jpeg', $headers['content-type'] );
- $this->assertEquals( '40148', $headers['content-length'] );
- $this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
+ $this->assertSame( 'image/jpeg', $headers['content-type'] );
+ $this->assertSame( '40148', $headers['content-length'] );
+ $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
}
function test_get_redirect_limit_exceeded() {
@@ -196,7 +196,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
// Check the host_only flag in the resulting WP_Http_Cookie.
$cookie = wp_remote_retrieve_cookie( $response, 'test' );
- $this->assertEquals( $cookie->domain, 'wordpress.org' );
+ $this->assertSame( $cookie->domain, 'wordpress.org' );
$this->assertFalse( $cookie->host_only, 'host-only flag not set' );
// Regurgitate (Requests_Cookie -> WP_Http_Cookie -> Requests_Cookie).
diff --git a/tests/phpunit/tests/http/http.php b/tests/phpunit/tests/http/http.php
index f18e6b719f..4986f1719b 100644
--- a/tests/phpunit/tests/http/http.php
+++ b/tests/phpunit/tests/http/http.php
@@ -13,7 +13,7 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
*/
function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
$actual = WP_Http::make_absolute_url( $relative_url, $absolute_url );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function make_absolute_url_testcases() {
@@ -72,7 +72,7 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
*/
function test_wp_parse_url( $url, $expected ) {
$actual = wp_parse_url( $url );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function parse_url_testcases() {
@@ -183,7 +183,7 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
*/
function test_wp_parse_url_with_default_component() {
$actual = wp_parse_url( self::FULL_TEST_URL, -1 );
- $this->assertEquals(
+ $this->assertSame(
array(
'scheme' => 'http',
'host' => 'host.name',
@@ -271,7 +271,7 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
// This primes the `$wp_header_to_desc` global:
get_status_header_desc( 200 );
- $this->assertEquals( array_keys( $wp_header_to_desc ), array_values( $constants ) );
+ $this->assertSame( array_keys( $wp_header_to_desc ), array_values( $constants ) );
}
diff --git a/tests/phpunit/tests/http/remoteRetrieveHeaders.php b/tests/phpunit/tests/http/remoteRetrieveHeaders.php
index 4551df7c54..1d4e42f2e9 100644
--- a/tests/phpunit/tests/http/remoteRetrieveHeaders.php
+++ b/tests/phpunit/tests/http/remoteRetrieveHeaders.php
@@ -13,7 +13,7 @@ class Tests_HTTP_RemoteRetrieveHeaders extends WP_UnitTestCase {
$response = array( 'headers' => $headers );
$result = wp_remote_retrieve_headers( $response );
- $this->assertEquals( $headers, $result );
+ $this->assertSame( $headers, $result );
}
/**
@@ -23,7 +23,7 @@ class Tests_HTTP_RemoteRetrieveHeaders extends WP_UnitTestCase {
$response = new WP_Error( 'Some error' );
$result = wp_remote_retrieve_headers( $response );
- $this->assertEquals( array(), $result );
+ $this->assertSame( array(), $result );
}
/**
@@ -33,6 +33,6 @@ class Tests_HTTP_RemoteRetrieveHeaders extends WP_UnitTestCase {
$response = array( 'no_headers' => 'set' );
$result = wp_remote_retrieve_headers( $response );
- $this->assertEquals( array(), $result );
+ $this->assertSame( array(), $result );
}
}
diff --git a/tests/phpunit/tests/image/base.php b/tests/phpunit/tests/image/base.php
index 3c32052b63..8392c548a0 100644
--- a/tests/phpunit/tests/image/base.php
+++ b/tests/phpunit/tests/image/base.php
@@ -48,7 +48,7 @@ abstract class WP_Image_UnitTestCase extends WP_UnitTestCase {
$colors = imagecolorsforindex( $im, $rgb );
- $this->assertEquals( $alpha, $colors['alpha'] );
+ $this->assertSame( $alpha, $colors['alpha'] );
}
/**
@@ -62,7 +62,7 @@ abstract class WP_Image_UnitTestCase extends WP_UnitTestCase {
$im = new Imagick( $image_path );
$pixel = $im->getImagePixelColor( $point[0], $point[1] );
$color = $pixel->getColorValue( imagick::COLOR_ALPHA );
- $this->assertEquals( $expected, $color );
+ $this->assertSame( $expected, $color );
}
/**
@@ -85,7 +85,7 @@ abstract class WP_Image_UnitTestCase extends WP_UnitTestCase {
$detected_height = $image_size[1];
}
- $this->assertEquals( $width, $detected_width );
- $this->assertEquals( $height, $detected_height );
+ $this->assertSame( $width, $detected_width );
+ $this->assertSame( $height, $detected_height );
}
}
diff --git a/tests/phpunit/tests/image/dimensions.php b/tests/phpunit/tests/image/dimensions.php
index 2dd75808f8..bbab2d3b39 100644
--- a/tests/phpunit/tests/image/dimensions.php
+++ b/tests/phpunit/tests/image/dimensions.php
@@ -10,72 +10,72 @@ class Tests_Image_Dimensions extends WP_UnitTestCase {
// Landscape: resize 640x480 to fit 400x400: 400x300.
$out = image_resize_dimensions( 640, 480, 400, 400, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );
// Portrait: resize 480x640 to fit 400x400: 300x400.
$out = image_resize_dimensions( 480, 640, 400, 400, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );
}
function test_400x0_no_crop() {
// Landscape: resize 640x480 to fit 400w: 400x300.
$out = image_resize_dimensions( 640, 480, 400, 0, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );
// Portrait: resize 480x640 to fit 400w: 400x533.
$out = image_resize_dimensions( 480, 640, 400, 0, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out );
}
function test_0x400_no_crop() {
// Landscape: resize 640x480 to fit 400h: 533x400.
$out = image_resize_dimensions( 640, 480, 0, 400, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out );
// Portrait: resize 480x640 to fit 400h: 300x400.
$out = image_resize_dimensions( 480, 640, 0, 400, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );
}
function test_800x800_no_crop() {
// Landscape: resize 640x480 to fit 800x800.
$out = image_resize_dimensions( 640, 480, 800, 800, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( false, $out );
+ $this->assertFalse( $out );
// Portrait: resize 480x640 to fit 800x800.
$out = image_resize_dimensions( 480, 640, 800, 800, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( false, $out );
+ $this->assertFalse( $out );
}
function test_800x0_no_crop() {
// Landscape: resize 640x480 to fit 800w.
$out = image_resize_dimensions( 640, 480, 800, 0, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( false, $out );
+ $this->assertFalse( $out );
// Portrait: resize 480x640 to fit 800w.
$out = image_resize_dimensions( 480, 640, 800, 0, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( false, $out );
+ $this->assertFalse( $out );
}
function test_0x800_no_crop() {
// Landscape: resize 640x480 to fit 800h.
$out = image_resize_dimensions( 640, 480, 0, 800, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( false, $out );
+ $this->assertFalse( $out );
// Portrait: resize 480x640 to fit 800h.
$out = image_resize_dimensions( 480, 640, 0, 800, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( false, $out );
+ $this->assertFalse( $out );
}
// Cropped versions.
@@ -84,48 +84,48 @@ class Tests_Image_Dimensions extends WP_UnitTestCase {
// Landscape: crop 640x480 to fit 400x400: 400x400 taken from a 480x480 crop at (80. 0).
$out = image_resize_dimensions( 640, 480, 400, 400, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 80, 0, 400, 400, 480, 480 ), $out );
+ $this->assertSame( array( 0, 0, 80, 0, 400, 400, 480, 480 ), $out );
// Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80).
$out = image_resize_dimensions( 480, 640, 400, 400, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 80, 400, 400, 480, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 80, 400, 400, 480, 480 ), $out );
}
function test_400x0_crop() {
// Landscape: resize 640x480 to fit 400w: 400x300.
$out = image_resize_dimensions( 640, 480, 400, 0, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );
// Portrait: resize 480x640 to fit 400w: 400x533.
$out = image_resize_dimensions( 480, 640, 400, 0, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out );
}
function test_0x400_crop() {
// Landscape: resize 640x480 to fit 400h: 533x400.
$out = image_resize_dimensions( 640, 480, 0, 400, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out );
// Portrait: resize 480x640 to fit 400h: 300x400.
$out = image_resize_dimensions( 480, 640, 0, 400, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );
}
function test_400x500_crop() {
// Landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop at (80. 0).
$out = image_resize_dimensions( 640, 480, 400, 500, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 120, 0, 400, 480, 400, 480 ), $out );
+ $this->assertSame( array( 0, 0, 120, 0, 400, 480, 400, 480 ), $out );
// Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80).
$out = image_resize_dimensions( 480, 640, 400, 500, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 20, 400, 500, 480, 600 ), $out );
+ $this->assertSame( array( 0, 0, 0, 20, 400, 500, 480, 600 ), $out );
}
function test_640x480() {
@@ -143,12 +143,12 @@ class Tests_Image_Dimensions extends WP_UnitTestCase {
// Crop 640x480 to fit 640x480 (no change).
$out = image_resize_dimensions( 640, 480, 640, 480, true );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out );
// Resize 640x480 to fit 640x480 (no change).
$out = image_resize_dimensions( 640, 480, 640, 480, false );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out );
remove_filter( 'wp_image_resize_identical_dimensions', '__return_true' );
}
@@ -161,25 +161,25 @@ class Tests_Image_Dimensions extends WP_UnitTestCase {
// src_x = 0 (left), src_y = 0 (top).
$out = image_resize_dimensions( 640, 480, 400, 500, array( 'left', 'top' ) );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 480, 400, 480 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 480, 400, 480 ), $out );
// Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop.
// src_x = 0 (left), src_y = 0 (top).
$out = image_resize_dimensions( 480, 640, 400, 500, array( 'left', 'top' ) );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 0, 400, 500, 480, 600 ), $out );
+ $this->assertSame( array( 0, 0, 0, 0, 400, 500, 480, 600 ), $out );
// Landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop.
// src_x = 240 (left), src_y = 0 (due to landscape crop).
$out = image_resize_dimensions( 640, 480, 400, 500, array( 'right', 'bottom' ) );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 240, 0, 400, 480, 400, 480 ), $out );
+ $this->assertSame( array( 0, 0, 240, 0, 400, 480, 400, 480 ), $out );
// Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop.
// src_x = 0 (due to portrait crop), src_y = 40 (bottom).
$out = image_resize_dimensions( 480, 640, 400, 500, array( 'right', 'bottom' ) );
// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h.
- $this->assertEquals( array( 0, 0, 0, 40, 400, 500, 480, 600 ), $out );
+ $this->assertSame( array( 0, 0, 0, 40, 400, 500, 480, 600 ), $out );
}
}
diff --git a/tests/phpunit/tests/image/editor.php b/tests/phpunit/tests/image/editor.php
index f602915331..34e2b29fd4 100644
--- a/tests/phpunit/tests/image/editor.php
+++ b/tests/phpunit/tests/image/editor.php
@@ -74,20 +74,20 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
$editor->set_mime_type( 'image/jpeg' ); // Ensure mime-specific filters act properly.
// Check default value.
- $this->assertEquals( 82, $editor->get_quality() );
+ $this->assertSame( 82, $editor->get_quality() );
// Ensure the quality filters do not have precedence if created after editor instantiation.
$func_100_percent = array( $this, 'return_integer_100' );
add_filter( 'wp_editor_set_quality', $func_100_percent );
- $this->assertEquals( 82, $editor->get_quality() );
+ $this->assertSame( 82, $editor->get_quality() );
$func_95_percent = array( $this, 'return_integer_95' );
add_filter( 'jpeg_quality', $func_95_percent );
- $this->assertEquals( 82, $editor->get_quality() );
+ $this->assertSame( 82, $editor->get_quality() );
// Ensure set_quality() works and overrides the filters.
$this->assertTrue( $editor->set_quality( 75 ) );
- $this->assertEquals( 75, $editor->get_quality() );
+ $this->assertSame( 75, $editor->get_quality() );
// Get a new editor to clear default quality state.
unset( $editor );
@@ -95,7 +95,7 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
$editor->set_mime_type( 'image/jpeg' ); // Ensure mime-specific filters act properly.
// Ensure jpeg_quality filter applies if it exists before editor instantiation.
- $this->assertEquals( 95, $editor->get_quality() );
+ $this->assertSame( 95, $editor->get_quality() );
// Get a new editor to clear jpeg_quality state.
remove_filter( 'jpeg_quality', $func_95_percent );
@@ -103,7 +103,7 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
// Ensure wp_editor_set_quality filter applies if it exists before editor instantiation.
- $this->assertEquals( 100, $editor->get_quality() );
+ $this->assertSame( 100, $editor->get_quality() );
// Clean up.
remove_filter( 'wp_editor_set_quality', $func_100_percent );
@@ -130,19 +130,19 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
);
// Test with no parameters.
- $this->assertEquals( 'canola-100x50.jpg', wp_basename( $editor->generate_filename() ) );
+ $this->assertSame( 'canola-100x50.jpg', wp_basename( $editor->generate_filename() ) );
// Test with a suffix only.
- $this->assertEquals( 'canola-new.jpg', wp_basename( $editor->generate_filename( 'new' ) ) );
+ $this->assertSame( 'canola-new.jpg', wp_basename( $editor->generate_filename( 'new' ) ) );
// Test with a destination dir only.
- $this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) );
+ $this->assertSame( trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) );
// Test with a suffix only.
- $this->assertEquals( 'canola-100x50.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) );
+ $this->assertSame( 'canola-100x50.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) );
// Combo!
- $this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ) . 'canola-new.png', $editor->generate_filename( 'new', realpath( get_temp_dir() ), 'png' ) );
+ $this->assertSame( trailingslashit( realpath( get_temp_dir() ) ) . 'canola-new.png', $editor->generate_filename( 'new', realpath( get_temp_dir() ), 'png' ) );
}
/**
@@ -166,7 +166,7 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
$property->setAccessible( true );
$property->setValue( $editor, $size );
- $this->assertEquals( $size, $editor->get_size() );
+ $this->assertSame( $size, $editor->get_size() );
}
/**
@@ -189,6 +189,6 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
$property->setAccessible( true );
$property->setValue( $editor, $size );
- $this->assertEquals( '100x50', $editor->get_suffix() );
+ $this->assertSame( '100x50', $editor->get_suffix() );
}
}
diff --git a/tests/phpunit/tests/image/editorGd.php b/tests/phpunit/tests/image/editorGd.php
index 0c9ddd650b..480d66f0ac 100644
--- a/tests/phpunit/tests/image/editorGd.php
+++ b/tests/phpunit/tests/image/editorGd.php
@@ -34,20 +34,20 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
public function test_supports_mime_type_jpeg() {
$gd_image_editor = new WP_Image_Editor_GD( null );
- $expected = imagetypes() & IMG_JPG;
- $this->assertEquals( $expected, $gd_image_editor->supports_mime_type( 'image/jpeg' ) );
+ $expected = (bool) ( imagetypes() & IMG_JPG );
+ $this->assertSame( $expected, $gd_image_editor->supports_mime_type( 'image/jpeg' ) );
}
public function test_supports_mime_type_png() {
$gd_image_editor = new WP_Image_Editor_GD( null );
- $expected = imagetypes() & IMG_PNG;
- $this->assertEquals( $expected, $gd_image_editor->supports_mime_type( 'image/png' ) );
+ $expected = (bool) ( imagetypes() & IMG_PNG );
+ $this->assertSame( $expected, $gd_image_editor->supports_mime_type( 'image/png' ) );
}
public function test_supports_mime_type_gif() {
$gd_image_editor = new WP_Image_Editor_GD( null );
- $expected = imagetypes() & IMG_GIF;
- $this->assertEquals( $expected, $gd_image_editor->supports_mime_type( 'image/gif' ) );
+ $expected = (bool) ( imagetypes() & IMG_GIF );
+ $this->assertSame( $expected, $gd_image_editor->supports_mime_type( 'image/gif' ) );
}
/**
@@ -61,7 +61,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
$gd_image_editor->resize( 100, 50 );
- $this->assertEquals(
+ $this->assertSame(
array(
'width' => 75,
'height' => 50,
@@ -98,7 +98,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
),
);
- $this->assertEquals( $expected_array, $resized );
+ $this->assertSame( $expected_array, $resized );
// Now, verify real dimensions are as expected.
$image_path = DIR_TESTDATA . '/images/' . $resized[0]['file'];
@@ -370,7 +370,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
);
$this->assertNotNull( $resized );
- $this->assertEquals( $expected_array, $resized );
+ $this->assertSame( $expected_array, $resized );
foreach ( $resized as $key => $image_data ) {
$image_path = DIR_TESTDATA . '/images/' . $image_data['file'];
@@ -395,7 +395,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
$gd_image_editor->resize( 100, 50, true );
- $this->assertEquals(
+ $this->assertSame(
array(
'width' => 100,
'height' => 50,
@@ -415,7 +415,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
$gd_image_editor->crop( 0, 0, 50, 50 );
- $this->assertEquals(
+ $this->assertSame(
array(
'width' => 50,
'height' => 50,
@@ -440,7 +440,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
$gd_image_editor->rotate( 180 );
- $this->assertEquals( $color_top_left, imagecolorat( $property->getValue( $gd_image_editor ), 99, 99 ) );
+ $this->assertSame( $color_top_left, imagecolorat( $property->getValue( $gd_image_editor ), 99, 99 ) );
}
/**
@@ -459,7 +459,7 @@ class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
$gd_image_editor->flip( true, false );
- $this->assertEquals( $color_top_left, imagecolorat( $property->getValue( $gd_image_editor ), 0, 99 ) );
+ $this->assertSame( $color_top_left, imagecolorat( $property->getValue( $gd_image_editor ), 0, 99 ) );
}
/**
diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php
index 812b112b77..a358c654af 100644
--- a/tests/phpunit/tests/image/editorImagick.php
+++ b/tests/phpunit/tests/image/editorImagick.php
@@ -54,7 +54,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$imagick_image_editor->resize( 100, 50 );
- $this->assertEquals(
+ $this->assertSame(
array(
'width' => 75,
'height' => 50,
@@ -91,7 +91,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
),
);
- $this->assertEquals( $expected_array, $resized );
+ $this->assertSame( $expected_array, $resized );
// Now, verify real dimensions are as expected.
$image_path = DIR_TESTDATA . '/images/' . $resized[0]['file'];
@@ -363,7 +363,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
);
$this->assertNotNull( $resized );
- $this->assertEquals( $expected_array, $resized );
+ $this->assertSame( $expected_array, $resized );
foreach ( $resized as $key => $image_data ) {
$image_path = DIR_TESTDATA . '/images/' . $image_data['file'];
@@ -388,7 +388,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$imagick_image_editor->resize( 100, 50, true );
- $this->assertEquals(
+ $this->assertSame(
array(
'width' => 100,
'height' => 50,
@@ -408,7 +408,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$imagick_image_editor->crop( 0, 0, 50, 50 );
- $this->assertEquals(
+ $this->assertSame(
array(
'width' => 50,
'height' => 50,
@@ -433,7 +433,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$imagick_image_editor->rotate( 180 );
- $this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 99, 99 )->getColor() );
+ $this->assertSame( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 99, 99 )->getColor() );
}
/**
@@ -452,7 +452,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$imagick_image_editor->flip( true, false );
- $this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );
+ $this->assertSame( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );
}
/**
@@ -558,7 +558,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$data = wp_read_image_metadata( $file );
// The orientation value 3 is equivalent to rotated upside down (180 degrees).
- $this->assertEquals( 3, intval( $data['orientation'] ), 'Orientation value read from does not match image file Exif data: ' . $file );
+ $this->assertSame( 3, intval( $data['orientation'] ), 'Orientation value read from does not match image file Exif data: ' . $file );
$temp_file = wp_tempnam( $file );
$image = wp_get_image_editor( $file );
@@ -570,7 +570,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$data = wp_read_image_metadata( $ret['path'] );
// Make sure the image is no longer in The Upside Down Exif orientation.
- $this->assertEquals( 1, intval( $data['orientation'] ), 'Orientation Exif data was not updated after rotating image: ' . $file );
+ $this->assertSame( 1, intval( $data['orientation'] ), 'Orientation Exif data was not updated after rotating image: ' . $file );
// Remove both the generated file ending in .tmp and tmp.jpg due to wp_tempnam().
unlink( $temp_file );
diff --git a/tests/phpunit/tests/image/functions.php b/tests/phpunit/tests/image/functions.php
index d6ea84e598..9c81ed6d93 100644
--- a/tests/phpunit/tests/image/functions.php
+++ b/tests/phpunit/tests/image/functions.php
@@ -186,7 +186,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$ret = wp_save_image_file( $file, $img, $mime_type, 1 );
$this->assertNotEmpty( $ret );
$this->assertNotWPError( $ret );
- $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+ $this->assertSame( $mime_type, $this->get_mime_type( $ret['path'] ) );
// Clean up.
unlink( $file );
@@ -228,7 +228,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
// Make assertions.
$this->assertNotEmpty( $ret );
$this->assertNotWPError( $ret );
- $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+ $this->assertSame( $mime_type, $this->get_mime_type( $ret['path'] ) );
// Clean up.
unlink( $file );
@@ -283,7 +283,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$ret = $img->save( trailingslashit( $temp ) . $file );
$this->assertNotEmpty( $ret );
$this->assertNotWPError( $ret );
- $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+ $this->assertSame( $mime_type, $this->get_mime_type( $ret['path'] ) );
unlink( $ret['path'] );
}
@@ -319,7 +319,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$loaded = $editor->load();
$this->assertInstanceOf( 'WP_Error', $loaded );
- $this->assertEquals( 'error_loading_image', $loaded->get_error_code() );
+ $this->assertSame( 'error_loading_image', $loaded->get_error_code() );
}
}
@@ -341,8 +341,8 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$this->assertFileExists( $file );
$image = wp_get_image_editor( $file );
$size = $image->get_size();
- $this->assertEquals( 100, $size['height'] );
- $this->assertEquals( 100, $size['width'] );
+ $this->assertSame( 100, $size['height'] );
+ $this->assertSame( 100, $size['width'] );
unlink( $file );
}
@@ -376,8 +376,8 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$this->assertFileExists( $file );
$image = wp_get_image_editor( $file );
$size = $image->get_size();
- $this->assertEquals( 100, $size['height'] );
- $this->assertEquals( 100, $size['width'] );
+ $this->assertSame( 100, $size['height'] );
+ $this->assertSame( 100, $size['width'] );
unlink( $file );
}
diff --git a/tests/phpunit/tests/image/header.php b/tests/phpunit/tests/image/header.php
index 1a619cdc6d..d378dddb2d 100644
--- a/tests/phpunit/tests/image/header.php
+++ b/tests/phpunit/tests/image/header.php
@@ -28,8 +28,8 @@ class Tests_Image_Header extends WP_UnitTestCase {
'height' => 1200,
)
);
- $this->assertEquals( 1200, $dimensions['dst_width'] );
- $this->assertEquals( 230, $dimensions['dst_height'] );
+ $this->assertSame( 1200, $dimensions['dst_width'] );
+ $this->assertSame( 230, $dimensions['dst_height'] );
}
@@ -48,8 +48,8 @@ class Tests_Image_Header extends WP_UnitTestCase {
'height' => 1200,
)
);
- $this->assertEquals( 1200, $dimensions['dst_width'] );
- $this->assertEquals( 230, $dimensions['dst_height'] );
+ $this->assertSame( 1200, $dimensions['dst_width'] );
+ $this->assertSame( 230, $dimensions['dst_height'] );
}
@@ -68,8 +68,8 @@ class Tests_Image_Header extends WP_UnitTestCase {
'height' => 1200,
)
);
- $this->assertEquals( 1200, $dimensions['dst_width'] );
- $this->assertEquals( 900, $dimensions['dst_height'] );
+ $this->assertSame( 1200, $dimensions['dst_width'] );
+ $this->assertSame( 900, $dimensions['dst_height'] );
}
@@ -88,8 +88,8 @@ class Tests_Image_Header extends WP_UnitTestCase {
'height' => 1200,
)
);
- $this->assertEquals( 1500, $dimensions['dst_width'] ); // Max width.
- $this->assertEquals( 230, $dimensions['dst_height'] );
+ $this->assertSame( 1500, $dimensions['dst_width'] ); // Max width.
+ $this->assertSame( 230, $dimensions['dst_height'] );
}
@@ -108,8 +108,8 @@ class Tests_Image_Header extends WP_UnitTestCase {
'height' => 1200,
)
);
- $this->assertEquals( 1600, $dimensions['dst_width'] );
- $this->assertEquals( 1200, $dimensions['dst_height'] );
+ $this->assertSame( 1600, $dimensions['dst_width'] );
+ $this->assertSame( 1200, $dimensions['dst_height'] );
}
@@ -126,10 +126,10 @@ class Tests_Image_Header extends WP_UnitTestCase {
$cropped = 'foo-cropped.png';
$object = $this->custom_image_header->create_attachment_object( $cropped, $id );
- $this->assertEquals( 'foo-cropped.png', $object['post_title'] );
- $this->assertEquals( 'http://localhost/' . $cropped, $object['guid'] );
- $this->assertEquals( 'custom-header', $object['context'] );
- $this->assertEquals( 'image/jpeg', $object['post_mime_type'] );
+ $this->assertSame( 'foo-cropped.png', $object['post_title'] );
+ $this->assertSame( 'http://localhost/' . $cropped, $object['guid'] );
+ $this->assertSame( 'custom-header', $object['context'] );
+ $this->assertSame( 'image/jpeg', $object['post_mime_type'] );
}
function test_insert_cropped_attachment() {
diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php
index c7d8307afc..c2ac785058 100644
--- a/tests/phpunit/tests/image/intermediateSize.php
+++ b/tests/phpunit/tests/image/intermediateSize.php
@@ -56,9 +56,9 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
$image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 100, 75, true );
$this->assertInternalType( 'array', $image );
- $this->assertEquals( 100, $image['width'] );
- $this->assertEquals( 75, $image['height'] );
- $this->assertEquals( 'image/jpeg', $image['mime-type'] );
+ $this->assertSame( 100, $image['width'] );
+ $this->assertSame( 75, $image['height'] );
+ $this->assertSame( 'image/jpeg', $image['mime-type'] );
$this->assertFalse( isset( $image['path'] ) );
diff --git a/tests/phpunit/tests/image/meta.php b/tests/phpunit/tests/image/meta.php
index 81d9d8e180..13f1b5abbd 100644
--- a/tests/phpunit/tests/image/meta.php
+++ b/tests/phpunit/tests/image/meta.php
@@ -22,32 +22,32 @@ class Tests_Image_Meta extends WP_UnitTestCase {
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/2004-07-22-DSC_0008.jpg' );
$this->assertEquals( 6.3, $out['aperture'] );
- $this->assertEquals( '', $out['credit'] );
- $this->assertEquals( 'NIKON D70', $out['camera'] );
- $this->assertEquals( '', $out['caption'] );
+ $this->assertSame( '', $out['credit'] );
+ $this->assertSame( 'NIKON D70', $out['camera'] );
+ $this->assertSame( '', $out['caption'] );
$this->assertEquals( strtotime( '2004-07-22 17:14:59' ), $out['created_timestamp'] );
- $this->assertEquals( '', $out['copyright'] );
+ $this->assertSame( '', $out['copyright'] );
$this->assertEquals( 27, $out['focal_length'] );
$this->assertEquals( 400, $out['iso'] );
$this->assertEquals( 1 / 40, $out['shutter_speed'] );
- $this->assertEquals( '', $out['title'] );
+ $this->assertSame( '', $out['title'] );
}
function test_exif_d70_mf() {
// Exif from a Nikon D70 - manual focus lens, so some data is unavailable.
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG' );
- $this->assertEquals( 0, $out['aperture'] );
- $this->assertEquals( '', $out['credit'] );
- $this->assertEquals( 'NIKON D70', $out['camera'] );
- $this->assertEquals( '', $out['caption'] );
+ $this->assertSame( '0', $out['aperture'] );
+ $this->assertSame( '', $out['credit'] );
+ $this->assertSame( 'NIKON D70', $out['camera'] );
+ $this->assertSame( '', $out['caption'] );
$this->assertEquals( strtotime( '2007-06-17 21:18:00' ), $out['created_timestamp'] );
- $this->assertEquals( '', $out['copyright'] );
+ $this->assertSame( '', $out['copyright'] );
$this->assertEquals( 0, $out['focal_length'] );
$this->assertEquals( 0, $out['iso'] ); // Interesting - a Nikon bug?
$this->assertEquals( 1 / 500, $out['shutter_speed'] );
- $this->assertEquals( '', $out['title'] );
- // $this->assertEquals( array( 'Flowers' ), $out['keywords'] );
+ $this->assertSame( '', $out['title'] );
+ // $this->assertSame( array( 'Flowers' ), $out['keywords'] );
}
function test_exif_d70_iptc() {
@@ -55,15 +55,15 @@ class Tests_Image_Meta extends WP_UnitTestCase {
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/2004-07-22-DSC_0007.jpg' );
$this->assertEquals( 6.3, $out['aperture'] );
- $this->assertEquals( 'IPTC Creator', $out['credit'] );
- $this->assertEquals( 'NIKON D70', $out['camera'] );
- $this->assertEquals( 'IPTC Caption', $out['caption'] );
+ $this->assertSame( 'IPTC Creator', $out['credit'] );
+ $this->assertSame( 'NIKON D70', $out['camera'] );
+ $this->assertSame( 'IPTC Caption', $out['caption'] );
$this->assertEquals( strtotime( '2004-07-22 17:14:35' ), $out['created_timestamp'] );
- $this->assertEquals( 'IPTC Copyright', $out['copyright'] );
+ $this->assertSame( 'IPTC Copyright', $out['copyright'] );
$this->assertEquals( 18, $out['focal_length'] );
$this->assertEquals( 200, $out['iso'] );
$this->assertEquals( 1 / 25, $out['shutter_speed'] );
- $this->assertEquals( 'IPTC Headline', $out['title'] );
+ $this->assertSame( 'IPTC Headline', $out['title'] );
}
function test_exif_fuji() {
@@ -71,15 +71,15 @@ class Tests_Image_Meta extends WP_UnitTestCase {
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/a2-small.jpg' );
$this->assertEquals( 4.5, $out['aperture'] );
- $this->assertEquals( '', $out['credit'] );
- $this->assertEquals( 'FinePix S5600', $out['camera'] );
- $this->assertEquals( '', $out['caption'] );
+ $this->assertSame( '', $out['credit'] );
+ $this->assertSame( 'FinePix S5600', $out['camera'] );
+ $this->assertSame( '', $out['caption'] );
$this->assertEquals( strtotime( '2007-09-03 10:17:03' ), $out['created_timestamp'] );
- $this->assertEquals( '', $out['copyright'] );
+ $this->assertSame( '', $out['copyright'] );
$this->assertEquals( 6.3, $out['focal_length'] );
$this->assertEquals( 64, $out['iso'] );
$this->assertEquals( 1 / 320, $out['shutter_speed'] );
- $this->assertEquals( '', $out['title'] );
+ $this->assertSame( '', $out['title'] );
}
@@ -92,15 +92,15 @@ class Tests_Image_Meta extends WP_UnitTestCase {
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/waffles.jpg' );
$this->assertEquals( 0, $out['aperture'] );
- $this->assertEquals( '', $out['credit'] );
- $this->assertEquals( '', $out['camera'] );
- $this->assertEquals( '', $out['caption'] );
+ $this->assertSame( '', $out['credit'] );
+ $this->assertSame( '', $out['camera'] );
+ $this->assertSame( '', $out['caption'] );
$this->assertEquals( 0, $out['created_timestamp'] );
- $this->assertEquals( '', $out['copyright'] );
+ $this->assertSame( '', $out['copyright'] );
$this->assertEquals( 0, $out['focal_length'] );
$this->assertEquals( 0, $out['iso'] );
$this->assertEquals( 0, $out['shutter_speed'] );
- $this->assertEquals( '', $out['title'] );
+ $this->assertSame( '', $out['title'] );
}
function test_exif_no_data() {
@@ -108,15 +108,15 @@ class Tests_Image_Meta extends WP_UnitTestCase {
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/canola.jpg' );
$this->assertEquals( 0, $out['aperture'] );
- $this->assertEquals( '', $out['credit'] );
- $this->assertEquals( '', $out['camera'] );
- $this->assertEquals( '', $out['caption'] );
+ $this->assertSame( '', $out['credit'] );
+ $this->assertSame( '', $out['camera'] );
+ $this->assertSame( '', $out['caption'] );
$this->assertEquals( 0, $out['created_timestamp'] );
- $this->assertEquals( '', $out['copyright'] );
+ $this->assertSame( '', $out['copyright'] );
$this->assertEquals( 0, $out['focal_length'] );
$this->assertEquals( 0, $out['iso'] );
$this->assertEquals( 0, $out['shutter_speed'] );
- $this->assertEquals( '', $out['title'] );
+ $this->assertSame( '', $out['title'] );
}
/**
@@ -126,7 +126,7 @@ class Tests_Image_Meta extends WP_UnitTestCase {
// Trilingual UTF-8 text in the ITPC caption-abstract field.
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/test-image-iptc.jpg' );
- $this->assertEquals( 'This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $out['caption'] );
+ $this->assertSame( 'This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $out['caption'] );
}
/**
@@ -144,18 +144,18 @@ class Tests_Image_Meta extends WP_UnitTestCase {
public function test_exif_keywords() {
$out = wp_read_image_metadata( DIR_TESTDATA . '/images/33772.jpg' );
- $this->assertEquals( '8', $out['aperture'] );
- $this->assertEquals( 'Photoshop Author', $out['credit'] );
- $this->assertEquals( 'DMC-LX2', $out['camera'] );
- $this->assertEquals( 'Photoshop Description', $out['caption'] );
+ $this->assertSame( '8', $out['aperture'] );
+ $this->assertSame( 'Photoshop Author', $out['credit'] );
+ $this->assertSame( 'DMC-LX2', $out['camera'] );
+ $this->assertSame( 'Photoshop Description', $out['caption'] );
$this->assertEquals( 1306315327, $out['created_timestamp'] );
- $this->assertEquals( 'Photoshop Copyrright Notice', $out['copyright'] );
- $this->assertEquals( '6.3', $out['focal_length'] );
- $this->assertEquals( '100', $out['iso'] );
- $this->assertEquals( '0.0025', $out['shutter_speed'] );
- $this->assertEquals( 'Photoshop Document Ttitle', $out['title'] );
+ $this->assertSame( 'Photoshop Copyrright Notice', $out['copyright'] );
+ $this->assertSame( '6.3', $out['focal_length'] );
+ $this->assertSame( '100', $out['iso'] );
+ $this->assertSame( '0.0025', $out['shutter_speed'] );
+ $this->assertSame( 'Photoshop Document Ttitle', $out['title'] );
$this->assertEquals( 1, $out['orientation'] );
- $this->assertEquals( array( 'beach', 'baywatch', 'LA', 'sunset' ), $out['keywords'] );
+ $this->assertSame( array( 'beach', 'baywatch', 'LA', 'sunset' ), $out['keywords'] );
}
}
diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php
index c03916af2a..05f9806bf5 100644
--- a/tests/phpunit/tests/image/resize.php
+++ b/tests/phpunit/tests/image/resize.php
@@ -29,11 +29,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
function test_resize_jpg() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 );
- $this->assertEquals( 'test-image-25x25.jpg', wp_basename( $image ) );
+ $this->assertSame( 'test-image-25x25.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 25, $w );
- $this->assertEquals( 25, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 25, $w );
+ $this->assertSame( 25, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -45,11 +45,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
$this->fail( sprintf( 'No PNG support in the editor engine %s on this system', $this->editor_engine ) );
}
- $this->assertEquals( 'test-image-25x25.png', wp_basename( $image ) );
+ $this->assertSame( 'test-image-25x25.png', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 25, $w );
- $this->assertEquals( 25, $h );
- $this->assertEquals( IMAGETYPE_PNG, $type );
+ $this->assertSame( 25, $w );
+ $this->assertSame( 25, $h );
+ $this->assertSame( IMAGETYPE_PNG, $type );
unlink( $image );
}
@@ -61,11 +61,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
$this->fail( sprintf( 'No GIF support in the editor engine %s on this system', $this->editor_engine ) );
}
- $this->assertEquals( 'test-image-25x25.gif', wp_basename( $image ) );
+ $this->assertSame( 'test-image-25x25.gif', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 25, $w );
- $this->assertEquals( 25, $h );
- $this->assertEquals( IMAGETYPE_GIF, $type );
+ $this->assertSame( 25, $w );
+ $this->assertSame( 25, $h );
+ $this->assertSame( IMAGETYPE_GIF, $type );
unlink( $image );
}
@@ -75,17 +75,17 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
$image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 100, 100 );
$this->assertInstanceOf( 'WP_Error', $image );
- $this->assertEquals( 'error_getting_dimensions', $image->get_error_code() );
+ $this->assertSame( 'error_getting_dimensions', $image->get_error_code() );
}
function test_resize_thumb_128x96() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 );
- $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) );
+ $this->assertSame( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 64, $w );
- $this->assertEquals( 96, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 64, $w );
+ $this->assertSame( 96, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -93,11 +93,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
function test_resize_thumb_128x0() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 );
- $this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', wp_basename( $image ) );
+ $this->assertSame( '2007-06-17DSC_4173-128x193.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 128, $w );
- $this->assertEquals( 193, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 128, $w );
+ $this->assertSame( 193, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -105,11 +105,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
function test_resize_thumb_0x96() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 );
- $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) );
+ $this->assertSame( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 64, $w );
- $this->assertEquals( 96, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 64, $w );
+ $this->assertSame( 96, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -117,11 +117,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
function test_resize_thumb_150x150_crop() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true );
- $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $image ) );
+ $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 150, $w );
- $this->assertEquals( 150, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 150, $w );
+ $this->assertSame( 150, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -129,11 +129,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
function test_resize_thumb_150x100_crop() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 100, true );
- $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', wp_basename( $image ) );
+ $this->assertSame( '2007-06-17DSC_4173-150x100.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 150, $w );
- $this->assertEquals( 100, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 150, $w );
+ $this->assertSame( 100, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -141,11 +141,11 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
function test_resize_thumb_50x150_crop() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true );
- $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', wp_basename( $image ) );
+ $this->assertSame( '2007-06-17DSC_4173-50x150.jpg', wp_basename( $image ) );
list($w, $h, $type) = getimagesize( $image );
- $this->assertEquals( 50, $w );
- $this->assertEquals( 150, $h );
- $this->assertEquals( IMAGETYPE_JPEG, $type );
+ $this->assertSame( 50, $w );
+ $this->assertSame( 150, $h );
+ $this->assertSame( IMAGETYPE_JPEG, $type );
unlink( $image );
}
@@ -159,7 +159,7 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
$image = $this->resize_helper( DIR_TESTDATA . '/images/test-non-existent-image.jpg', 25, 25 );
$this->assertInstanceOf( 'WP_Error', $image );
- $this->assertEquals( 'error_loading_image', $image->get_error_code() );
+ $this->assertSame( 'error_loading_image', $image->get_error_code() );
}
/**
diff --git a/tests/phpunit/tests/image/resizeGd.php b/tests/phpunit/tests/image/resizeGd.php
index 51bbb8e193..fc39c9f7f6 100644
--- a/tests/phpunit/tests/image/resizeGd.php
+++ b/tests/phpunit/tests/image/resizeGd.php
@@ -33,7 +33,7 @@ class Test_Image_Resize_GD extends WP_Tests_Image_Resize_UnitTestCase {
$image = $this->resize_helper( DIR_TESTDATA . '/export/crazy-cdata.xml', 25, 25 );
$this->assertInstanceOf( 'WP_Error', $image );
- $this->assertEquals( 'invalid_image', $image->get_error_code() );
+ $this->assertSame( 'invalid_image', $image->get_error_code() );
}
}
diff --git a/tests/phpunit/tests/image/siteIcon.php b/tests/phpunit/tests/image/siteIcon.php
index c55bdc7e4b..595a1a5f21 100644
--- a/tests/phpunit/tests/image/siteIcon.php
+++ b/tests/phpunit/tests/image/siteIcon.php
@@ -36,7 +36,7 @@ class Tests_WP_Site_Icon extends WP_UnitTestCase {
$sizes[] = 'site_icon-' . $size;
}
- $this->assertEquals( $sizes, $image_sizes );
+ $this->assertSame( $sizes, $image_sizes );
}
function test_intermediate_image_sizes_with_filter() {
@@ -52,7 +52,7 @@ class Tests_WP_Site_Icon extends WP_UnitTestCase {
$this->assertContains( 'site_icon-321', $image_sizes );
// All icon sizes should be part of the array, including sizes added through the filter.
- $this->assertEquals( $sizes, $image_sizes );
+ $this->assertSame( $sizes, $image_sizes );
// Remove custom size.
unset( $this->wp_site_icon->site_icon_sizes[ array_search( 321, $this->wp_site_icon->site_icon_sizes, true ) ] );
@@ -72,7 +72,7 @@ class Tests_WP_Site_Icon extends WP_UnitTestCase {
);
}
- $this->assertEquals( $sizes, $image_sizes );
+ $this->assertSame( $sizes, $image_sizes );
}
function test_additional_sizes_with_filter() {
@@ -92,7 +92,7 @@ class Tests_WP_Site_Icon extends WP_UnitTestCase {
$this->assertArrayHasKey( 'site_icon-321', $image_sizes );
// All icon sizes should be part of the array, including sizes added through the filter.
- $this->assertEquals( $sizes, $image_sizes );
+ $this->assertSame( $sizes, $image_sizes );
// Remove custom size.
unset( $this->wp_site_icon->site_icon_sizes[ array_search( 321, $this->wp_site_icon->site_icon_sizes, true ) ] );
@@ -105,11 +105,11 @@ class Tests_WP_Site_Icon extends WP_UnitTestCase {
$object = $this->wp_site_icon->create_attachment_object( $cropped, $attachment_id );
- $this->assertEquals( $object['post_title'], 'cropped-test-image.jpg' );
- $this->assertEquals( $object['context'], 'site-icon' );
- $this->assertEquals( $object['post_mime_type'], 'image/jpeg' );
- $this->assertEquals( $object['post_content'], $cropped );
- $this->assertEquals( $object['guid'], $cropped );
+ $this->assertSame( $object['post_title'], 'cropped-test-image.jpg' );
+ $this->assertSame( $object['context'], 'site-icon' );
+ $this->assertSame( $object['post_mime_type'], 'image/jpeg' );
+ $this->assertSame( $object['post_content'], $cropped );
+ $this->assertSame( $object['guid'], $cropped );
}
function test_insert_cropped_attachment() {
diff --git a/tests/phpunit/tests/import/import.php b/tests/phpunit/tests/import/import.php
index 1454bed8be..0dfb60b369 100644
--- a/tests/phpunit/tests/import/import.php
+++ b/tests/phpunit/tests/import/import.php
@@ -51,27 +51,27 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
// Ensure that authors were imported correctly.
$user_count = count_users();
- $this->assertEquals( 3, $user_count['total_users'] );
+ $this->assertSame( 3, $user_count['total_users'] );
$admin = get_user_by( 'login', 'admin' );
- $this->assertEquals( 'admin', $admin->user_login );
- $this->assertEquals( 'local@host.null', $admin->user_email );
+ $this->assertSame( 'admin', $admin->user_login );
+ $this->assertSame( 'local@host.null', $admin->user_email );
$editor = get_user_by( 'login', 'editor' );
- $this->assertEquals( 'editor', $editor->user_login );
- $this->assertEquals( 'editor@example.org', $editor->user_email );
- $this->assertEquals( 'FirstName', $editor->user_firstname );
- $this->assertEquals( 'LastName', $editor->user_lastname );
+ $this->assertSame( 'editor', $editor->user_login );
+ $this->assertSame( 'editor@example.org', $editor->user_email );
+ $this->assertSame( 'FirstName', $editor->user_firstname );
+ $this->assertSame( 'LastName', $editor->user_lastname );
$author = get_user_by( 'login', 'author' );
- $this->assertEquals( 'author', $author->user_login );
- $this->assertEquals( 'author@example.org', $author->user_email );
+ $this->assertSame( 'author', $author->user_login );
+ $this->assertSame( 'author@example.org', $author->user_email );
// Check that terms were imported correctly.
$this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
$this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
$foo = get_term_by( 'slug', 'foo', 'category' );
- $this->assertEquals( 0, $foo->parent );
+ $this->assertSame( 0, $foo->parent );
$bar = get_term_by( 'slug', 'bar', 'category' );
$foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
- $this->assertEquals( $bar->term_id, $foo_bar->parent );
+ $this->assertSame( $bar->term_id, $foo_bar->parent );
// Check that posts/pages were imported correctly.
$post_count = wp_count_posts( 'post' );
@@ -91,120 +91,120 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
'orderby' => 'ID',
)
);
- $this->assertEquals( 11, count( $posts ) );
+ $this->assertSame( 11, count( $posts ) );
$post = $posts[0];
- $this->assertEquals( 'Many Categories', $post->post_title );
- $this->assertEquals( 'many-categories', $post->post_name );
+ $this->assertSame( 'Many Categories', $post->post_title );
+ $this->assertSame( 'many-categories', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'post', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
+ $this->assertSame( 'post', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
$cats = wp_get_post_categories( $post->ID );
- $this->assertEquals( 27, count( $cats ) );
+ $this->assertSame( 27, count( $cats ) );
$post = $posts[1];
- $this->assertEquals( 'Non-standard post format', $post->post_title );
- $this->assertEquals( 'non-standard-post-format', $post->post_name );
+ $this->assertSame( 'Non-standard post format', $post->post_title );
+ $this->assertSame( 'non-standard-post-format', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'post', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
+ $this->assertSame( 'post', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
$cats = wp_get_post_categories( $post->ID );
- $this->assertEquals( 1, count( $cats ) );
+ $this->assertSame( 1, count( $cats ) );
$this->assertTrue( has_post_format( 'aside', $post->ID ) );
$post = $posts[2];
- $this->assertEquals( 'Top-level Foo', $post->post_title );
- $this->assertEquals( 'top-level-foo', $post->post_name );
+ $this->assertSame( 'Top-level Foo', $post->post_title );
+ $this->assertSame( 'top-level-foo', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'post', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
+ $this->assertSame( 'post', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
$cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
- $this->assertEquals( 1, count( $cats ) );
- $this->assertEquals( 'foo', $cats[0]->slug );
+ $this->assertSame( 1, count( $cats ) );
+ $this->assertSame( 'foo', $cats[0]->slug );
$post = $posts[3];
- $this->assertEquals( 'Foo-child', $post->post_title );
- $this->assertEquals( 'foo-child', $post->post_name );
+ $this->assertSame( 'Foo-child', $post->post_title );
+ $this->assertSame( 'foo-child', $post->post_name );
$this->assertEquals( $editor->ID, $post->post_author );
- $this->assertEquals( 'post', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
+ $this->assertSame( 'post', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
$cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
- $this->assertEquals( 1, count( $cats ) );
- $this->assertEquals( 'foo-bar', $cats[0]->slug );
+ $this->assertSame( 1, count( $cats ) );
+ $this->assertSame( 'foo-bar', $cats[0]->slug );
$post = $posts[4];
- $this->assertEquals( 'Private Post', $post->post_title );
- $this->assertEquals( 'private-post', $post->post_name );
+ $this->assertSame( 'Private Post', $post->post_title );
+ $this->assertSame( 'private-post', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'post', $post->post_type );
- $this->assertEquals( 'private', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
+ $this->assertSame( 'post', $post->post_type );
+ $this->assertSame( 'private', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
$cats = wp_get_post_categories( $post->ID );
- $this->assertEquals( 1, count( $cats ) );
+ $this->assertSame( 1, count( $cats ) );
$tags = wp_get_post_tags( $post->ID );
- $this->assertEquals( 3, count( $tags ) );
- $this->assertEquals( 'tag1', $tags[0]->slug );
- $this->assertEquals( 'tag2', $tags[1]->slug );
- $this->assertEquals( 'tag3', $tags[2]->slug );
+ $this->assertSame( 3, count( $tags ) );
+ $this->assertSame( 'tag1', $tags[0]->slug );
+ $this->assertSame( 'tag2', $tags[1]->slug );
+ $this->assertSame( 'tag3', $tags[2]->slug );
$post = $posts[5];
- $this->assertEquals( '1-col page', $post->post_title );
- $this->assertEquals( '1-col-page', $post->post_name );
+ $this->assertSame( '1-col page', $post->post_title );
+ $this->assertSame( '1-col-page', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'page', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
- $this->assertEquals( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) );
+ $this->assertSame( 'page', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
+ $this->assertSame( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) );
$post = $posts[6];
- $this->assertEquals( 'Draft Page', $post->post_title );
- $this->assertEquals( '', $post->post_name );
+ $this->assertSame( 'Draft Page', $post->post_title );
+ $this->assertSame( '', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'page', $post->post_type );
- $this->assertEquals( 'draft', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
- $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+ $this->assertSame( 'page', $post->post_type );
+ $this->assertSame( 'draft', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
+ $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
$post = $posts[7];
- $this->assertEquals( 'Parent Page', $post->post_title );
- $this->assertEquals( 'parent-page', $post->post_name );
+ $this->assertSame( 'Parent Page', $post->post_title );
+ $this->assertSame( 'parent-page', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'page', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
- $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+ $this->assertSame( 'page', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
+ $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
$post = $posts[8];
- $this->assertEquals( 'Child Page', $post->post_title );
- $this->assertEquals( 'child-page', $post->post_name );
+ $this->assertSame( 'Child Page', $post->post_title );
+ $this->assertSame( 'child-page', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'page', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( $posts[7]->ID, $post->post_parent );
- $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+ $this->assertSame( 'page', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( $posts[7]->ID, $post->post_parent );
+ $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
$post = $posts[9];
- $this->assertEquals( 'Sample Page', $post->post_title );
- $this->assertEquals( 'sample-page', $post->post_name );
+ $this->assertSame( 'Sample Page', $post->post_title );
+ $this->assertSame( 'sample-page', $post->post_name );
$this->assertEquals( $admin->ID, $post->post_author );
- $this->assertEquals( 'page', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
- $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+ $this->assertSame( 'page', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
+ $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
$post = $posts[10];
- $this->assertEquals( 'Hello world!', $post->post_title );
- $this->assertEquals( 'hello-world', $post->post_name );
+ $this->assertSame( 'Hello world!', $post->post_title );
+ $this->assertSame( 'hello-world', $post->post_name );
$this->assertEquals( $author->ID, $post->post_author );
- $this->assertEquals( 'post', $post->post_type );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( 0, $post->post_parent );
+ $this->assertSame( 'post', $post->post_type );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( 0, $post->post_parent );
$cats = wp_get_post_categories( $post->ID );
- $this->assertEquals( 1, count( $cats ) );
+ $this->assertSame( 1, count( $cats ) );
}
function test_double_import() {
@@ -217,26 +217,26 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
$this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
$user_count = count_users();
- $this->assertEquals( 3, $user_count['total_users'] );
+ $this->assertSame( 3, $user_count['total_users'] );
$admin = get_user_by( 'login', 'admin' );
- $this->assertEquals( 'admin', $admin->user_login );
- $this->assertEquals( 'local@host.null', $admin->user_email );
+ $this->assertSame( 'admin', $admin->user_login );
+ $this->assertSame( 'local@host.null', $admin->user_email );
$editor = get_user_by( 'login', 'editor' );
- $this->assertEquals( 'editor', $editor->user_login );
- $this->assertEquals( 'editor@example.org', $editor->user_email );
- $this->assertEquals( 'FirstName', $editor->user_firstname );
- $this->assertEquals( 'LastName', $editor->user_lastname );
+ $this->assertSame( 'editor', $editor->user_login );
+ $this->assertSame( 'editor@example.org', $editor->user_email );
+ $this->assertSame( 'FirstName', $editor->user_firstname );
+ $this->assertSame( 'LastName', $editor->user_lastname );
$author = get_user_by( 'login', 'author' );
- $this->assertEquals( 'author', $author->user_login );
- $this->assertEquals( 'author@example.org', $author->user_email );
+ $this->assertSame( 'author', $author->user_login );
+ $this->assertSame( 'author@example.org', $author->user_email );
$this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
$this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
$foo = get_term_by( 'slug', 'foo', 'category' );
- $this->assertEquals( 0, $foo->parent );
+ $this->assertSame( 0, $foo->parent );
$bar = get_term_by( 'slug', 'bar', 'category' );
$foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
- $this->assertEquals( $bar->term_id, $foo_bar->parent );
+ $this->assertSame( $bar->term_id, $foo_bar->parent );
$post_count = wp_count_posts( 'post' );
$this->assertEquals( 5, $post_count->publish );
@@ -258,7 +258,7 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
'ABC1' => array( 'ABC1' ),
'def1' => array( 'def1' ),
);
- $this->assertEquals(
+ $this->assertSame(
array(
'ABC1' => array( 'ABC1' ),
'abc2' => array( 'abc2' ),
diff --git a/tests/phpunit/tests/import/parser.php b/tests/phpunit/tests/import/parser.php
index af27b0b29e..82214c110d 100644
--- a/tests/phpunit/tests/import/parser.php
+++ b/tests/phpunit/tests/import/parser.php
@@ -32,7 +32,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$parser = new $p;
$result = $parser->parse( $file );
$this->assertWPError( $result );
- $this->assertEquals( 'There was an error when reading this WXR file', $result->get_error_message() );
+ $this->assertSame( 'There was an error when reading this WXR file', $result->get_error_message() );
}
}
@@ -45,7 +45,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$parser = new $p;
$result = $parser->parse( $file );
$this->assertWPError( $result );
- $this->assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );
+ $this->assertSame( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );
}
}
}
@@ -59,7 +59,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$result = $parser->parse( $file );
$this->assertTrue( is_array( $result ), $message );
- $this->assertEquals( 'http://localhost/', $result['base_url'], $message );
+ $this->assertSame( 'http://localhost/', $result['base_url'], $message );
$this->assertEquals(
array(
'author_id' => 2,
@@ -106,9 +106,9 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$message
);
- $this->assertEquals( 2, count( $result['posts'] ), $message );
- $this->assertEquals( 19, count( $result['posts'][0] ), $message );
- $this->assertEquals( 18, count( $result['posts'][1] ), $message );
+ $this->assertSame( 2, count( $result['posts'] ), $message );
+ $this->assertSame( 19, count( $result['posts'][0] ), $message );
+ $this->assertSame( 18, count( $result['posts'][1] ), $message );
$this->assertEquals(
array(
array(
@@ -130,7 +130,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$result['posts'][0]['terms'],
$message
);
- $this->assertEquals(
+ $this->assertSame(
array(
array(
'key' => '_wp_page_template',
@@ -152,17 +152,17 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$result = $parser->parse( $file );
$this->assertTrue( is_array( $result ), $message );
- $this->assertEquals( 'http://localhost/', $result['base_url'], $message );
- $this->assertEquals( $result['categories'][0]['category_nicename'], 'alpha', $message );
- $this->assertEquals( $result['categories'][0]['cat_name'], 'alpha', $message );
- $this->assertEquals( $result['categories'][0]['category_parent'], '', $message );
- $this->assertEquals( $result['categories'][0]['category_description'], 'The alpha category', $message );
- $this->assertEquals( $result['tags'][0]['tag_slug'], 'chicken', $message );
- $this->assertEquals( $result['tags'][0]['tag_name'], 'chicken', $message );
+ $this->assertSame( 'http://localhost/', $result['base_url'], $message );
+ $this->assertSame( $result['categories'][0]['category_nicename'], 'alpha', $message );
+ $this->assertSame( $result['categories'][0]['cat_name'], 'alpha', $message );
+ $this->assertSame( $result['categories'][0]['category_parent'], '', $message );
+ $this->assertSame( $result['categories'][0]['category_description'], 'The alpha category', $message );
+ $this->assertSame( $result['tags'][0]['tag_slug'], 'chicken', $message );
+ $this->assertSame( $result['tags'][0]['tag_name'], 'chicken', $message );
- $this->assertEquals( 6, count( $result['posts'] ), $message );
- $this->assertEquals( 19, count( $result['posts'][0] ), $message );
- $this->assertEquals( 18, count( $result['posts'][1] ), $message );
+ $this->assertSame( 6, count( $result['posts'] ), $message );
+ $this->assertSame( 19, count( $result['posts'][0] ), $message );
+ $this->assertSame( 18, count( $result['posts'][1] ), $message );
$this->assertEquals(
array(
@@ -218,7 +218,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$message
);
- $this->assertEquals(
+ $this->assertSame(
array(
array(
'key' => '_wp_page_template',
@@ -246,7 +246,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$result = $parser->parse( $file );
$post = $result['posts'][0];
- $this->assertEquals( 'Content with nested :)', $post['post_content'], $message );
+ $this->assertSame( 'Content with nested :)', $post['post_content'], $message );
foreach ( $post['postmeta'] as $meta ) {
switch ( $meta['key'] ) {
case 'Plain string':
@@ -261,7 +261,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
default:
$this->fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
}
- $this->assertEquals( $value, $meta['value'], $message );
+ $this->assertSame( $value, $meta['value'], $message );
}
}
}
@@ -277,7 +277,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
$result = $parser->parse( $file );
$post = $result['posts'][0];
- $this->assertEquals( 'Content with nested :)', $post['post_content'] );
+ $this->assertSame( 'Content with nested :)', $post['post_content'] );
foreach ( $post['postmeta'] as $meta ) {
switch ( $meta['key'] ) {
case 'Plain string':
@@ -292,7 +292,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
default:
$this->fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
}
- $this->assertEquals( $value, $meta['value'] );
+ $this->assertSame( $value, $meta['value'] );
}
}
diff --git a/tests/phpunit/tests/import/postmeta.php b/tests/phpunit/tests/import/postmeta.php
index d4d9c5c3a0..54a05743de 100644
--- a/tests/phpunit/tests/import/postmeta.php
+++ b/tests/phpunit/tests/import/postmeta.php
@@ -28,7 +28,7 @@ class Tests_Import_Postmeta extends WP_Import_UnitTestCase {
$this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-no-cdata.xml', array( 'johncoswell' => 'john' ) );
$expected['special_post_title'] = 'A special title';
$expected['is_calendar'] = '';
- $this->assertEquals( $expected, get_post_meta( 122, 'post-options', true ) );
+ $this->assertSame( $expected, get_post_meta( 122, 'post-options', true ) );
}
function test_utw_postmeta() {
@@ -84,11 +84,11 @@ class Tests_Import_Postmeta extends WP_Import_UnitTestCase {
$this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => 'johncoswell' ) );
// HTML in the CDATA should work with old WordPress version.
- $this->assertEquals( 'some html
', get_post_meta( 10, 'contains-html', true ) );
+ $this->assertSame( 'some html
', get_post_meta( 10, 'contains-html', true ) );
// Serialised will only work with 3.0 onwards.
$expected['special_post_title'] = 'A special title';
$expected['is_calendar'] = '';
- $this->assertEquals( $expected, get_post_meta( 10, 'post-options', true ) );
+ $this->assertSame( $expected, get_post_meta( 10, 'post-options', true ) );
}
/**
@@ -97,6 +97,6 @@ class Tests_Import_Postmeta extends WP_Import_UnitTestCase {
function test_serialized_postmeta_with_evil_stuff_in_cdata() {
$this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => 'johncoswell' ) );
// Evil content in the CDATA.
- $this->assertEquals( 'evil', get_post_meta( 10, 'evil', true ) );
+ $this->assertSame( 'evil', get_post_meta( 10, 'evil', true ) );
}
}
diff --git a/tests/phpunit/tests/includes/factory.php b/tests/phpunit/tests/includes/factory.php
index 63f87ce619..8fd351e772 100644
--- a/tests/phpunit/tests/includes/factory.php
+++ b/tests/phpunit/tests/includes/factory.php
@@ -19,14 +19,14 @@ class TestFactoryFor extends WP_UnitTestCase {
function test_get_object_by_id_gets_an_object_with_the_same_name() {
$id = $this->category_factory->create( array( 'name' => 'Boo' ) );
$object = $this->category_factory->get_object_by_id( $id );
- $this->assertEquals( 'Boo', $object->name );
+ $this->assertSame( 'Boo', $object->name );
}
function test_the_taxonomy_argument_overrules_the_factory_taxonomy() {
$term_factory = new WP_UnitTest_Factory_For_term( null, 'category' );
$id = $term_factory->create( array( 'taxonomy' => 'post_tag' ) );
$term = get_term( $id, 'post_tag' );
- $this->assertEquals( $id, $term->term_id );
+ $this->assertSame( $id, $term->term_id );
}
/**
diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php
index 37753260e9..0a6527a56d 100644
--- a/tests/phpunit/tests/kses.php
+++ b/tests/phpunit/tests/kses.php
@@ -29,7 +29,7 @@ class Tests_Kses extends WP_UnitTestCase {
foreach ( (array) $values as $value ) {
$string = "1 WordPress Avenue, The Internet.";
$expect_string = "1 WordPress Avenue, The Internet.";
- $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
+ $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) );
}
}
}
@@ -63,7 +63,7 @@ class Tests_Kses extends WP_UnitTestCase {
}
$string = "I link this";
$expect_string = "I link this";
- $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
+ $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) );
}
}
@@ -137,7 +137,7 @@ class Tests_Kses extends WP_UnitTestCase {
foreach ( $attributes as $name => $value ) {
$string = "WP";
$expect_string = "WP";
- $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
+ $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) );
}
}
@@ -172,7 +172,7 @@ EOF;
CLICK ME
EOF;
- $this->assertEquals( $expected, wp_kses( $content, $allowedposttags ) );
+ $this->assertSame( $expected, wp_kses( $content, $allowedposttags ) );
}
function test_wp_kses_bad_protocol() {
@@ -211,25 +211,25 @@ EOF;
if ( ! empty( $result ) && 'alert(1);' !== $result && 'alert(1)' !== $result ) {
switch ( $k ) {
case 6:
- $this->assertEquals( 'javascript:alert(1);', $result );
+ $this->assertSame( 'javascript:alert(1);', $result );
break;
case 12:
- $this->assertEquals( str_replace( '&', '&', $x ), $result );
+ $this->assertSame( str_replace( '&', '&', $x ), $result );
break;
case 22:
- $this->assertEquals( 'javascript:alert(1);', $result );
+ $this->assertSame( 'javascript:alert(1);', $result );
break;
case 23:
- $this->assertEquals( 'javascript:alert(1)//?:', $result );
+ $this->assertSame( 'javascript:alert(1)//?:', $result );
break;
case 24:
- $this->assertEquals( 'feed:alert(1)', $result );
+ $this->assertSame( 'feed:alert(1)', $result );
break;
case 26:
- $this->assertEquals( 'javascript:alert(1)', $result );
+ $this->assertSame( 'javascript:alert(1)', $result );
break;
case 27:
- $this->assertEquals( 'javascript:x=1;alert(1)', $result );
+ $this->assertSame( 'javascript:x=1;alert(1)', $result );
break;
default:
$this->fail( "wp_kses_bad_protocol failed on $k, $x. Result: $result" );
@@ -304,106 +304,106 @@ EOF;
switch ( $attack->name ) {
case 'XSS Locator':
- $this->assertEquals( '\';alert(String.fromCharCode(88,83,83))//\\\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\\";alert(String.fromCharCode(88,83,83))//-->">\'>alert(String.fromCharCode(88,83,83))=&{}', $result );
+ $this->assertSame( '\';alert(String.fromCharCode(88,83,83))//\\\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\\";alert(String.fromCharCode(88,83,83))//-->">\'>alert(String.fromCharCode(88,83,83))=&{}', $result );
break;
case 'XSS Quick Test':
- $this->assertEquals( '\'\';!--"=&{()}', $result );
+ $this->assertSame( '\'\';!--"=&{()}', $result );
break;
case 'SCRIPT w/Alert()':
- $this->assertEquals( "alert('XSS')", $result );
+ $this->assertSame( "alert('XSS')", $result );
break;
case 'SCRIPT w/Char Code':
- $this->assertEquals( 'alert(String.fromCharCode(88,83,83))', $result );
+ $this->assertSame( 'alert(String.fromCharCode(88,83,83))', $result );
break;
case 'IMG STYLE w/expression':
- $this->assertEquals( 'exp/*', $result );
+ $this->assertSame( 'exp/*', $result );
break;
case 'List-style-image':
- $this->assertEquals( 'li {list-style-image: url("javascript:alert(\'XSS\')");}XSS', $result );
+ $this->assertSame( 'li {list-style-image: url("javascript:alert(\'XSS\')");}XSS', $result );
break;
case 'STYLE':
- $this->assertEquals( "alert('XSS');", $result );
+ $this->assertSame( "alert('XSS');", $result );
break;
case 'STYLE w/background-image':
- $this->assertEquals( '.XSS{background-image:url("javascript:alert(\'XSS\')");}', $result );
+ $this->assertSame( '.XSS{background-image:url("javascript:alert(\'XSS\')");}', $result );
break;
case 'STYLE w/background':
- $this->assertEquals( 'BODY{background:url("javascript:alert(\'XSS\')")}', $result );
+ $this->assertSame( 'BODY{background:url("javascript:alert(\'XSS\')")}', $result );
break;
case 'Remote Stylesheet 2':
- $this->assertEquals( "@import'http://ha.ckers.org/xss.css';", $result );
+ $this->assertSame( "@import'http://ha.ckers.org/xss.css';", $result );
break;
case 'Remote Stylesheet 3':
- $this->assertEquals( '<META HTTP-EQUIV="Link" Content="; REL=stylesheet">', $result );
+ $this->assertSame( '<META HTTP-EQUIV="Link" Content="; REL=stylesheet">', $result );
break;
case 'Remote Stylesheet 4':
- $this->assertEquals( 'BODY{-moz-binding:url("http://ha.ckers.org/xssmoz.xml#xss")}', $result );
+ $this->assertSame( 'BODY{-moz-binding:url("http://ha.ckers.org/xssmoz.xml#xss")}', $result );
break;
case 'XML data island w/CDATA':
- $this->assertEquals( '<![CDATA[]]>', $result );
+ $this->assertSame( '<![CDATA[]]>', $result );
break;
case 'XML data island w/comment':
- $this->assertEquals( "<IMG SRC="javascript:alert('XSS')\">", $result );
+ $this->assertSame( "<IMG SRC="javascript:alert('XSS')\">", $result );
break;
case 'XML HTML+TIME':
- $this->assertEquals( '<t:set attributeName="innerHTML" to="XSSalert(\'XSS\')">', $result );
+ $this->assertSame( '<t:set attributeName="innerHTML" to="XSSalert(\'XSS\')">', $result );
break;
case 'Commented-out Block':
- $this->assertEquals( "\nalert('XSS');", $result );
+ $this->assertSame( "\nalert('XSS');", $result );
break;
case 'Cookie Manipulation':
- $this->assertEquals( '<META HTTP-EQUIV="Set-Cookie" Content="USERID=alert(\'XSS\')">', $result );
+ $this->assertSame( '<META HTTP-EQUIV="Set-Cookie" Content="USERID=alert(\'XSS\')">', $result );
break;
case 'SSI':
- $this->assertEquals( '<!--#exec cmd="/bin/echo '', $result );
+ $this->assertSame( '<!--#exec cmd="/bin/echo '', $result );
break;
case 'PHP':
- $this->assertEquals( '<? echo('alert("XSS")\'); ?>', $result );
+ $this->assertSame( '<? echo('alert("XSS")\'); ?>', $result );
break;
case 'UTF-7 Encoding':
- $this->assertEquals( '+ADw-SCRIPT+AD4-alert(\'XSS\');+ADw-/SCRIPT+AD4-', $result );
+ $this->assertSame( '+ADw-SCRIPT+AD4-alert(\'XSS\');+ADw-/SCRIPT+AD4-', $result );
break;
case 'Escaping JavaScript escapes':
- $this->assertEquals( '\";alert(\'XSS\');//', $result );
+ $this->assertSame( '\";alert(\'XSS\');//', $result );
break;
case 'STYLE w/broken up JavaScript':
- $this->assertEquals( '@im\port\'\ja\vasc\ript:alert("XSS")\';', $result );
+ $this->assertSame( '@im\port\'\ja\vasc\ript:alert("XSS")\';', $result );
break;
case 'Null Chars 2':
- $this->assertEquals( '&alert("XSS")', $result );
+ $this->assertSame( '&alert("XSS")', $result );
break;
case 'No Closing Script Tag':
- $this->assertEquals( '<SCRIPT SRC=http://ha.ckers.org/xss.js', $result );
+ $this->assertSame( '<SCRIPT SRC=http://ha.ckers.org/xss.js', $result );
break;
case 'Half-Open HTML/JavaScript':
- $this->assertEquals( '<IMG SRC="javascript:alert('XSS')"', $result );
+ $this->assertSame( '<IMG SRC="javascript:alert('XSS')"', $result );
break;
case 'Double open angle brackets':
- $this->assertEquals( '<IFRAME SRC=http://ha.ckers.org/scriptlet.html <', $result );
+ $this->assertSame( '<IFRAME SRC=http://ha.ckers.org/scriptlet.html <', $result );
break;
case 'Extraneous Open Brackets':
- $this->assertEquals( '<alert("XSS");//<', $result );
+ $this->assertSame( '<alert("XSS");//<', $result );
break;
case 'Malformed IMG Tags':
- $this->assertEquals( 'alert("XSS")">', $result );
+ $this->assertSame( 'alert("XSS")">', $result );
break;
case 'No Quotes/Semicolons':
- $this->assertEquals( "a=/XSS/\nalert(a.source)", $result );
+ $this->assertSame( "a=/XSS/\nalert(a.source)", $result );
break;
case 'Evade Regex Filter 1':
- $this->assertEquals( '" SRC="http://ha.ckers.org/xss.js">', $result );
+ $this->assertSame( '" SRC="http://ha.ckers.org/xss.js">', $result );
break;
case 'Evade Regex Filter 4':
- $this->assertEquals( '\'" SRC="http://ha.ckers.org/xss.js">', $result );
+ $this->assertSame( '\'" SRC="http://ha.ckers.org/xss.js">', $result );
break;
case 'Evade Regex Filter 5':
- $this->assertEquals( '` SRC="http://ha.ckers.org/xss.js">', $result );
+ $this->assertSame( '` SRC="http://ha.ckers.org/xss.js">', $result );
break;
case 'Filter Evasion 1':
- $this->assertEquals( 'document.write("<SCRI");PT SRC="http://ha.ckers.org/xss.js">', $result );
+ $this->assertSame( 'document.write("<SCRI");PT SRC="http://ha.ckers.org/xss.js">', $result );
break;
case 'Filter Evasion 2':
- $this->assertEquals( '\'>" SRC="http://ha.ckers.org/xss.js">', $result );
+ $this->assertSame( '\'>" SRC="http://ha.ckers.org/xss.js">', $result );
break;
default:
$this->fail( 'KSES failed on ' . $attack->name . ': ' . $result );
@@ -425,7 +425,7 @@ EOF;
public function test_wp_kses_allowed_html() {
global $allowedposttags, $allowedtags, $allowedentitynames;
- $this->assertEquals( $allowedposttags, wp_kses_allowed_html( 'post' ) );
+ $this->assertSame( $allowedposttags, wp_kses_allowed_html( 'post' ) );
$tags = wp_kses_allowed_html( 'post' );
@@ -436,9 +436,9 @@ EOF;
$this->assertTrue( $tag['title'] );
}
- $this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
- $this->assertEquals( $allowedtags, wp_kses_allowed_html( '' ) );
- $this->assertEquals( $allowedtags, wp_kses_allowed_html() );
+ $this->assertSame( $allowedtags, wp_kses_allowed_html( 'data' ) );
+ $this->assertSame( $allowedtags, wp_kses_allowed_html( '' ) );
+ $this->assertSame( $allowedtags, wp_kses_allowed_html() );
$tags = wp_kses_allowed_html( 'user_description' );
$this->assertTrue( $tags['a']['rel'] );
@@ -446,7 +446,7 @@ EOF;
$tags = wp_kses_allowed_html();
$this->assertFalse( isset( $tags['a']['rel'] ) );
- $this->assertEquals( array(), wp_kses_allowed_html( 'strip' ) );
+ $this->assertSame( array(), wp_kses_allowed_html( 'strip' ) );
$custom_tags = array(
'a' => array(
@@ -458,16 +458,16 @@ EOF;
),
);
- $this->assertEquals( $custom_tags, wp_kses_allowed_html( $custom_tags ) );
+ $this->assertSame( $custom_tags, wp_kses_allowed_html( $custom_tags ) );
add_filter( 'wp_kses_allowed_html', array( $this, '_wp_kses_allowed_html_filter' ), 10, 2 );
- $this->assertEquals( array( 'a' => array( 'href' => true ) ), wp_kses_allowed_html( 'post' ) );
- $this->assertEquals( array( 'a' => array( 'href' => false ) ), wp_kses_allowed_html( 'data' ) );
+ $this->assertSame( array( 'a' => array( 'href' => true ) ), wp_kses_allowed_html( 'post' ) );
+ $this->assertSame( array( 'a' => array( 'href' => false ) ), wp_kses_allowed_html( 'data' ) );
remove_filter( 'wp_kses_allowed_html', array( $this, '_wp_kses_allowed_html_filter' ) );
- $this->assertEquals( $allowedposttags, wp_kses_allowed_html( 'post' ) );
- $this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
+ $this->assertSame( $allowedposttags, wp_kses_allowed_html( 'post' ) );
+ $this->assertSame( $allowedtags, wp_kses_allowed_html( 'data' ) );
}
function test_hyphenated_tag() {
@@ -480,23 +480,23 @@ EOF;
$expect_stripped_string = 'Alot of hyphens.';
$expect_valid_string = 'Alot of hyphens.';
- $this->assertEquals( $expect_stripped_string, wp_kses_post( $string ) );
- $this->assertEquals( $expect_valid_string, wp_kses( $string, $custom_tags ) );
+ $this->assertSame( $expect_stripped_string, wp_kses_post( $string ) );
+ $this->assertSame( $expect_valid_string, wp_kses( $string, $custom_tags ) );
}
/**
* @ticket 26290
*/
public function test_wp_kses_normalize_entities() {
- $this->assertEquals( '♠', wp_kses_normalize_entities( '♠' ) );
+ $this->assertSame( '♠', wp_kses_normalize_entities( '♠' ) );
- $this->assertEquals( '¹', wp_kses_normalize_entities( '¹' ) );
- $this->assertEquals( '²', wp_kses_normalize_entities( '²' ) );
- $this->assertEquals( '³', wp_kses_normalize_entities( '³' ) );
- $this->assertEquals( '¼', wp_kses_normalize_entities( '¼' ) );
- $this->assertEquals( '½', wp_kses_normalize_entities( '½' ) );
- $this->assertEquals( '¾', wp_kses_normalize_entities( '¾' ) );
- $this->assertEquals( '∴', wp_kses_normalize_entities( '∴' ) );
+ $this->assertSame( '¹', wp_kses_normalize_entities( '¹' ) );
+ $this->assertSame( '²', wp_kses_normalize_entities( '²' ) );
+ $this->assertSame( '³', wp_kses_normalize_entities( '³' ) );
+ $this->assertSame( '¼', wp_kses_normalize_entities( '¼' ) );
+ $this->assertSame( '½', wp_kses_normalize_entities( '½' ) );
+ $this->assertSame( '¾', wp_kses_normalize_entities( '¾' ) );
+ $this->assertSame( '∴', wp_kses_normalize_entities( '∴' ) );
}
/**
@@ -508,7 +508,7 @@ EOF;
function test_ctrl_removal( $input, $output ) {
global $allowedposttags;
- return $this->assertEquals( $output, wp_kses( $input, $allowedposttags ) );
+ return $this->assertSame( $output, wp_kses( $input, $allowedposttags ) );
}
function data_ctrl_removal() {
@@ -545,7 +545,7 @@ EOF;
function test_slash_zero_removal( $input, $output ) {
global $allowedposttags;
- return $this->assertEquals( $output, wp_kses( $input, $allowedposttags ) );
+ return $this->assertSame( $output, wp_kses( $input, $allowedposttags ) );
}
function data_slash_zero_removal() {
@@ -595,7 +595,7 @@ EOF;
* @dataProvider data_hair_parse
*/
function test_hair_parse( $input, $output ) {
- return $this->assertEquals( $output, wp_kses_hair_parse( $input ) );
+ return $this->assertSame( $output, wp_kses_hair_parse( $input ) );
}
function data_hair_parse() {
@@ -661,7 +661,7 @@ EOF;
* @dataProvider data_attr_parse
*/
function test_attr_parse( $input, $output ) {
- return $this->assertEquals( $output, wp_kses_attr_parse( $input ) );
+ return $this->assertSame( $output, wp_kses_attr_parse( $input ) );
}
function data_attr_parse() {
@@ -719,7 +719,7 @@ EOF;
* @dataProvider data_one_attr
*/
function test_one_attr( $element, $input, $output ) {
- return $this->assertEquals( $output, wp_kses_one_attr( $input, $element ) );
+ return $this->assertSame( $output, wp_kses_one_attr( $input, $element ) );
}
function data_one_attr() {
@@ -800,7 +800,7 @@ EOF;
$input = 'This is a BDO tag. Weird, right?
';
- $this->assertEquals( $input, wp_kses( $input, $allowedposttags ) );
+ $this->assertSame( $input, wp_kses( $input, $allowedposttags ) );
}
/**
@@ -811,7 +811,7 @@ EOF;
$input = '- Item 1
- Item 2
- Item 3
';
- $this->assertEquals( $input, wp_kses( $input, $allowedposttags ) );
+ $this->assertSame( $input, wp_kses( $input, $allowedposttags ) );
}
/**
@@ -821,7 +821,7 @@ EOF;
$element = 'foo';
$attribute = 'title="foo" class="bar"';
- $this->assertEquals( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => array() ), array() ) );
+ $this->assertSame( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => array() ), array() ) );
}
/**
@@ -831,7 +831,7 @@ EOF;
$element = 'foo';
$attribute = 'title="foo" class="bar"';
- $this->assertEquals( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => true ), array() ) );
+ $this->assertSame( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => true ), array() ) );
}
/**
@@ -841,7 +841,7 @@ EOF;
$element = 'foo';
$attribute = 'title="foo" class="bar"';
- $this->assertEquals( "<{$element} title=\"foo\">", wp_kses_attr( $element, $attribute, array( 'foo' => array( 'title' => true ) ), array() ) );
+ $this->assertSame( "<{$element} title=\"foo\">", wp_kses_attr( $element, $attribute, array( 'foo' => array( 'title' => true ) ), array() ) );
}
/**
@@ -851,7 +851,7 @@ EOF;
$element = 'foo';
$attribute = 'title="foo" class="bar"';
- $this->assertEquals( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => false ), array() ) );
+ $this->assertSame( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => false ), array() ) );
}
/**
@@ -1057,7 +1057,7 @@ EOF;
$test = 'Pens and pencils
';
$expected = 'Pens and pencils
';
- $this->assertEquals( $expected, wp_kses_post( $test ) );
+ $this->assertSame( $expected, wp_kses_post( $test ) );
}
/**
diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php
index 7c8e492fc5..f39bdb8307 100644
--- a/tests/phpunit/tests/l10n.php
+++ b/tests/phpunit/tests/l10n.php
@@ -23,9 +23,9 @@ class Tests_L10n extends WP_UnitTestCase {
$nooped_plural = _n_noop( '%s post', '%s posts', $text_domain );
$this->assertNotEmpty( $nooped_plural['domain'] );
- $this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 0, $text_domain ) );
- $this->assertEquals( '%s post', translate_nooped_plural( $nooped_plural, 1, $text_domain ) );
- $this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 2, $text_domain ) );
+ $this->assertSame( '%s posts', translate_nooped_plural( $nooped_plural, 0, $text_domain ) );
+ $this->assertSame( '%s post', translate_nooped_plural( $nooped_plural, 1, $text_domain ) );
+ $this->assertSame( '%s posts', translate_nooped_plural( $nooped_plural, 2, $text_domain ) );
}
/**
@@ -37,18 +37,18 @@ class Tests_L10n extends WP_UnitTestCase {
$this->assertNotEmpty( $nooped_plural['domain'] );
$this->assertNotEmpty( $nooped_plural['context'] );
- $this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 0, $text_domain ) );
- $this->assertEquals( '%s post', translate_nooped_plural( $nooped_plural, 1, $text_domain ) );
- $this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 2, $text_domain ) );
+ $this->assertSame( '%s posts', translate_nooped_plural( $nooped_plural, 0, $text_domain ) );
+ $this->assertSame( '%s post', translate_nooped_plural( $nooped_plural, 1, $text_domain ) );
+ $this->assertSame( '%s posts', translate_nooped_plural( $nooped_plural, 2, $text_domain ) );
}
/**
* @ticket 35073
*/
function test_before_last_bar() {
- $this->assertEquals( 'no-bar-at-all', before_last_bar( 'no-bar-at-all' ) );
- $this->assertEquals( 'before-last-bar', before_last_bar( 'before-last-bar|after-bar' ) );
- $this->assertEquals( 'first-before-bar|second-before-bar', before_last_bar( 'first-before-bar|second-before-bar|after-last-bar' ) );
+ $this->assertSame( 'no-bar-at-all', before_last_bar( 'no-bar-at-all' ) );
+ $this->assertSame( 'before-last-bar', before_last_bar( 'before-last-bar|after-bar' ) );
+ $this->assertSame( 'first-before-bar|second-before-bar', before_last_bar( 'first-before-bar|second-before-bar|after-last-bar' ) );
}
/**
@@ -62,7 +62,7 @@ class Tests_L10n extends WP_UnitTestCase {
$this->assertEmpty( $array );
$array = get_available_languages( DIR_TESTDATA . '/languages/' );
- $this->assertEquals( array( 'de_DE', 'en_GB', 'es_ES', 'ja_JP' ), $array );
+ $this->assertSame( array( 'de_DE', 'en_GB', 'es_ES', 'ja_JP' ), $array );
}
/**
@@ -76,15 +76,15 @@ class Tests_L10n extends WP_UnitTestCase {
$this->assertNotEmpty( $installed_translations['default']['en_GB'] );
$data_en_gb = $installed_translations['default']['en_GB'];
- $this->assertEquals( '2016-10-26 00:01+0200', $data_en_gb['PO-Revision-Date'] );
- $this->assertEquals( 'Development (4.4.x)', $data_en_gb['Project-Id-Version'] );
- $this->assertEquals( 'Poedit 1.8.10', $data_en_gb['X-Generator'] );
+ $this->assertSame( '2016-10-26 00:01+0200', $data_en_gb['PO-Revision-Date'] );
+ $this->assertSame( 'Development (4.4.x)', $data_en_gb['Project-Id-Version'] );
+ $this->assertSame( 'Poedit 1.8.10', $data_en_gb['X-Generator'] );
$this->assertNotEmpty( $installed_translations['admin']['es_ES'] );
$data_es_es = $installed_translations['admin']['es_ES'];
- $this->assertEquals( '2016-10-25 18:29+0200', $data_es_es['PO-Revision-Date'] );
- $this->assertEquals( 'Administration', $data_es_es['Project-Id-Version'] );
- $this->assertEquals( 'Poedit 1.8.10', $data_es_es['X-Generator'] );
+ $this->assertSame( '2016-10-25 18:29+0200', $data_es_es['PO-Revision-Date'] );
+ $this->assertSame( 'Administration', $data_es_es['Project-Id-Version'] );
+ $this->assertSame( 'Poedit 1.8.10', $data_es_es['X-Generator'] );
}
/**
diff --git a/tests/phpunit/tests/l10n/loadScriptTextdomain.php b/tests/phpunit/tests/l10n/loadScriptTextdomain.php
index 310cc72bea..9f4e1012ba 100644
--- a/tests/phpunit/tests/l10n/loadScriptTextdomain.php
+++ b/tests/phpunit/tests/l10n/loadScriptTextdomain.php
@@ -32,18 +32,18 @@ class Tests_L10n_loadScriptTextdomain extends WP_UnitTestCase {
$json_translations = file_get_contents( DIR_TESTDATA . '/languages/en_US-813e104eb47e13dd4cc5af844c618754.json' );
wp_enqueue_script( 'test-example-root', '/wp-includes/js/script.js', array(), null );
- $this->assertEquals( $json_translations, load_script_textdomain( 'test-example-root', 'default', DIR_TESTDATA . '/languages' ) );
+ $this->assertSame( $json_translations, load_script_textdomain( 'test-example-root', 'default', DIR_TESTDATA . '/languages' ) );
// Assets on a CDN.
add_filter( 'load_script_textdomain_relative_path', array( $this, 'relative_path_from_cdn' ), 10, 2 );
wp_enqueue_script( 'test-example-cdn', 'https://my-cdn.com/wordpress/wp-includes/js/script.js', array(), null );
- $this->assertEquals( $json_translations, load_script_textdomain( 'test-example-cdn', 'default', DIR_TESTDATA . '/languages' ) );
+ $this->assertSame( $json_translations, load_script_textdomain( 'test-example-cdn', 'default', DIR_TESTDATA . '/languages' ) );
remove_filter( 'load_script_textdomain_relative_path', array( $this, 'relative_path_from_cdn' ) );
// Test for WordPress installs in a subdirectory.
add_filter( 'site_url', array( $this, 'site_url_subdirectory' ) );
wp_enqueue_script( 'test-example-subdir', '/wp/wp-includes/js/script.js', array(), null );
- $this->assertEquals( $json_translations, load_script_textdomain( 'test-example-subdir', 'default', DIR_TESTDATA . '/languages' ) );
+ $this->assertSame( $json_translations, load_script_textdomain( 'test-example-subdir', 'default', DIR_TESTDATA . '/languages' ) );
remove_filter( 'site_url', array( $this, 'site_url_subdirectory' ) );
}
@@ -55,7 +55,7 @@ class Tests_L10n_loadScriptTextdomain extends WP_UnitTestCase {
add_filter( 'plugins_url', array( $this, 'plugins_url_custom_domain' ) );
wp_enqueue_script( 'plugin-example-1', 'https://plugins.example.com/my-plugin/js/script.js', array(), null );
- $this->assertEquals( $json_translations, load_script_textdomain( 'plugin-example-1', 'internationalized-plugin', DIR_TESTDATA . '/languages' ) );
+ $this->assertSame( $json_translations, load_script_textdomain( 'plugin-example-1', 'internationalized-plugin', DIR_TESTDATA . '/languages' ) );
remove_filter( 'plugins_url', array( $this, 'plugins_url_custom_domain' ) );
}
@@ -67,7 +67,7 @@ class Tests_L10n_loadScriptTextdomain extends WP_UnitTestCase {
add_filter( 'content_url', array( $this, 'content_url_custom_domain_with_no_path' ) );
wp_enqueue_script( 'plugin-example-2', 'https://content.example.com/plugins/my-plugin/js/script.js', array(), null );
- $this->assertEquals( $json_translations, load_script_textdomain( 'plugin-example-2', 'internationalized-plugin', DIR_TESTDATA . '/languages' ) );
+ $this->assertSame( $json_translations, load_script_textdomain( 'plugin-example-2', 'internationalized-plugin', DIR_TESTDATA . '/languages' ) );
remove_filter( 'content_url', array( $this, 'content_url_custom_domain_with_no_path' ) );
}
}
diff --git a/tests/phpunit/tests/link.php b/tests/phpunit/tests/link.php
index 263da2fe50..62f55fbd7d 100644
--- a/tests/phpunit/tests/link.php
+++ b/tests/phpunit/tests/link.php
@@ -21,7 +21,7 @@ class Tests_Link extends WP_UnitTestCase {
$paged = get_pagenum_link( 2 );
remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
- $this->assertEquals( $paged, home_url( '/WooHoo/page/2/' ) );
+ $this->assertSame( $paged, home_url( '/WooHoo/page/2/' ) );
$_SERVER['REQUEST_URI'] = $old_req_uri;
}
@@ -31,43 +31,43 @@ class Tests_Link extends WP_UnitTestCase {
$post_id2 = self::factory()->post->create();
// Basic case.
- $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+ $this->assertSame( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
unset( $GLOBALS['post'] );
// Global post is not set.
- $this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
- $this->assertEquals( '', wp_get_shortlink( 0 ) );
- $this->assertEquals( '', wp_get_shortlink() );
+ $this->assertSame( '', wp_get_shortlink( 0, 'post' ) );
+ $this->assertSame( '', wp_get_shortlink( 0 ) );
+ $this->assertSame( '', wp_get_shortlink() );
$GLOBALS['post'] = get_post( $post_id );
// Global post is set.
- $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) );
- $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0 ) );
- $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink() );
+ $this->assertSame( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) );
+ $this->assertSame( get_permalink( $post_id ), wp_get_shortlink( 0 ) );
+ $this->assertSame( get_permalink( $post_id ), wp_get_shortlink() );
// Not the global post.
- $this->assertEquals( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) );
+ $this->assertSame( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) );
unset( $GLOBALS['post'] );
// Global post is not set, once again.
- $this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
- $this->assertEquals( '', wp_get_shortlink( 0 ) );
- $this->assertEquals( '', wp_get_shortlink() );
+ $this->assertSame( '', wp_get_shortlink( 0, 'post' ) );
+ $this->assertSame( '', wp_get_shortlink( 0 ) );
+ $this->assertSame( '', wp_get_shortlink() );
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
// With a permalink structure set, get_permalink() will no longer match.
$this->assertNotEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+ $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
// Global post and permalink structure are set.
$GLOBALS['post'] = get_post( $post_id );
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
+ $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );
+ $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
+ $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink() );
}
function test_wp_get_shortlink_with_page() {
@@ -75,11 +75,11 @@ class Tests_Link extends WP_UnitTestCase {
// Basic case.
// Don't test against get_permalink() since it uses ?page_id= for pages.
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+ $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+ $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
}
/**
@@ -90,11 +90,11 @@ class Tests_Link extends WP_UnitTestCase {
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $post_id );
- $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
+ $this->assertSame( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
- $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
+ $this->assertSame( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
}
/**
@@ -114,7 +114,7 @@ class Tests_Link extends WP_UnitTestCase {
$non_pretty_permalink = add_query_arg( 'p', $p, trailingslashit( home_url() ) );
- $this->assertEquals( $non_pretty_permalink, get_permalink( $p ) );
+ $this->assertSame( $non_pretty_permalink, get_permalink( $p ) );
}
/**
@@ -143,7 +143,7 @@ class Tests_Link extends WP_UnitTestCase {
trailingslashit( home_url() )
);
- $this->assertEquals( $non_pretty_permalink, get_permalink( $p ) );
+ $this->assertSame( $non_pretty_permalink, get_permalink( $p ) );
}
/**
diff --git a/tests/phpunit/tests/link/getAdjacentPost.php b/tests/phpunit/tests/link/getAdjacentPost.php
index 97dbba38b9..2954732ef2 100644
--- a/tests/phpunit/tests/link/getAdjacentPost.php
+++ b/tests/phpunit/tests/link/getAdjacentPost.php
@@ -58,13 +58,13 @@ class Tests_Link_GetAdjacentPost extends WP_UnitTestCase {
// Test category adjacency.
$this->go_to( get_permalink( $post_one->ID ) );
- $this->assertEquals( '', get_adjacent_post( true, '', true, 'category' ) );
+ $this->assertSame( '', get_adjacent_post( true, '', true, 'category' ) );
$this->assertEquals( $post_three, get_adjacent_post( true, '', false, 'category' ) );
// Test tag adjacency.
$this->go_to( get_permalink( $post_two->ID ) );
- $this->assertEquals( '', get_adjacent_post( true, '', true, 'post_tag' ) );
+ $this->assertSame( '', get_adjacent_post( true, '', true, 'post_tag' ) );
$this->assertEquals( $post_four, get_adjacent_post( true, '', false, 'post_tag' ) );
// Test normal boundary post.
@@ -204,7 +204,7 @@ class Tests_Link_GetAdjacentPost extends WP_UnitTestCase {
}
// Should skip $p2, which belongs to $t.
- $this->assertEquals( $p3, $found->ID );
+ $this->assertSame( $p3, $found->ID );
}
/**
@@ -241,7 +241,7 @@ class Tests_Link_GetAdjacentPost extends WP_UnitTestCase {
}
// Should skip $p2, which belongs to $t.
- $this->assertEquals( $p3, $found->ID );
+ $this->assertSame( $p3, $found->ID );
}
/**
diff --git a/tests/phpunit/tests/link/getDashboardUrl.php b/tests/phpunit/tests/link/getDashboardUrl.php
index 1b70e13a70..be051b3027 100644
--- a/tests/phpunit/tests/link/getDashboardUrl.php
+++ b/tests/phpunit/tests/link/getDashboardUrl.php
@@ -22,7 +22,7 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
* @ticket 39065
*/
public function test_get_dashboard_url_for_current_site_user() {
- $this->assertEquals( admin_url(), get_dashboard_url( self::$user_id ) );
+ $this->assertSame( admin_url(), get_dashboard_url( self::$user_id ) );
}
/**
@@ -33,7 +33,7 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
$expected = is_multisite() ? user_admin_url() : admin_url();
- $this->assertEquals( $expected, get_dashboard_url( self::$user_id ) );
+ $this->assertSame( $expected, get_dashboard_url( self::$user_id ) );
}
/**
@@ -50,7 +50,7 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
revoke_super_admin( self::$user_id );
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
/**
@@ -70,6 +70,6 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
wp_delete_site( $site_id );
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
}
diff --git a/tests/phpunit/tests/link/getPostCommentsFeedLink.php b/tests/phpunit/tests/link/getPostCommentsFeedLink.php
index e96aa97af6..c905ff08cf 100644
--- a/tests/phpunit/tests/link/getPostCommentsFeedLink.php
+++ b/tests/phpunit/tests/link/getPostCommentsFeedLink.php
@@ -16,7 +16,7 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
home_url( '/' )
);
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
public function test_post_pretty_link() {
@@ -27,7 +27,7 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
$link = get_post_comments_feed_link( $post_id );
$expected = get_permalink( $post_id ) . 'feed/';
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
public function test_attachment_link() {
@@ -50,7 +50,7 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
home_url( '/' )
);
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
public function test_attachment_pretty_link() {
@@ -76,7 +76,7 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
$link = get_post_comments_feed_link( $attachment_id );
$expected = get_permalink( $post_id ) . 'burrito/feed/';
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
public function test_attachment_no_name_pretty_link() {
@@ -95,7 +95,7 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
$link = get_post_comments_feed_link( $attachment_id );
$expected = get_permalink( $post_id ) . 'attachment/' . $attachment_id . '/feed/';
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
public function test_unattached_link() {
@@ -117,7 +117,7 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
home_url( '/' )
);
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
public function test_unattached_pretty_link() {
@@ -135,6 +135,6 @@ class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase {
$link = get_post_comments_feed_link( $attachment_id );
$expected = add_query_arg( 'attachment_id', $attachment_id, home_url( '/feed/' ) );
- $this->assertEquals( $expected, $link );
+ $this->assertSame( $expected, $link );
}
}
diff --git a/tests/phpunit/tests/link/getPreviewPostLink.php b/tests/phpunit/tests/link/getPreviewPostLink.php
index 79ea850af2..a689cb31f3 100644
--- a/tests/phpunit/tests/link/getPreviewPostLink.php
+++ b/tests/phpunit/tests/link/getPreviewPostLink.php
@@ -8,7 +8,7 @@ class Tests_Link_GetPreviewPostLink extends WP_UnitTestCase {
public function test_get_preview_post_link() {
$post = self::factory()->post->create();
- $this->assertEquals( add_query_arg( 'preview', 'true', get_permalink( $post ) ), get_preview_post_link( $post ) );
+ $this->assertSame( add_query_arg( 'preview', 'true', get_permalink( $post ) ), get_preview_post_link( $post ) );
}
public function test_get_preview_post_link_should_add_additional_query_vars() {
@@ -23,7 +23,7 @@ class Tests_Link_GetPreviewPostLink extends WP_UnitTestCase {
get_permalink( $post )
);
- $this->assertEquals(
+ $this->assertSame(
$expected,
get_preview_post_link(
$post,
@@ -40,7 +40,7 @@ class Tests_Link_GetPreviewPostLink extends WP_UnitTestCase {
$expected = 'https://google.com/?foo=bar&bar=baz&preview=true';
- $this->assertEquals(
+ $this->assertSame(
$expected,
get_preview_post_link(
$post,
@@ -64,7 +64,7 @@ class Tests_Link_GetPreviewPostLink extends WP_UnitTestCase {
$GLOBALS['post'] = $post;
- $this->assertEquals( add_query_arg( 'preview', 'true', get_permalink( $post ) ), get_preview_post_link() );
+ $this->assertSame( add_query_arg( 'preview', 'true', get_permalink( $post ) ), get_preview_post_link() );
}
public function test_get_preview_post_link_should_return_empty_string_for_non_viewable_post_type() {
diff --git a/tests/phpunit/tests/link/getPreviousCommentsLink.php b/tests/phpunit/tests/link/getPreviousCommentsLink.php
index ff4c088dea..6872f90e89 100644
--- a/tests/phpunit/tests/link/getPreviousCommentsLink.php
+++ b/tests/phpunit/tests/link/getPreviousCommentsLink.php
@@ -28,10 +28,10 @@ class Tests_Link_GetPreviousCommentsLink extends WP_UnitTestCase {
$cpage = get_query_var( 'cpage' );
set_query_var( 'cpage', '' );
- $link = get_previous_comments_link( 'Next', 5 );
+ $link = get_previous_comments_link( 'Next' );
// Technically, it returns null here.
- $this->assertEquals( '', $link );
+ $this->assertNull( $link );
set_query_var( 'cpage', $cpage );
}
diff --git a/tests/phpunit/tests/link/wpGetCanonicalURL.php b/tests/phpunit/tests/link/wpGetCanonicalURL.php
index 2dedd63c1a..c6f0722db6 100644
--- a/tests/phpunit/tests/link/wpGetCanonicalURL.php
+++ b/tests/phpunit/tests/link/wpGetCanonicalURL.php
@@ -41,7 +41,7 @@ class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
* Test for a page that is not the queried object.
*/
public function test_non_current_page() {
- $this->assertEquals( get_permalink( self::$post_id ), wp_get_canonical_url( self::$post_id ) );
+ $this->assertSame( get_permalink( self::$post_id ), wp_get_canonical_url( self::$post_id ) );
}
/**
@@ -65,7 +65,7 @@ class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
get_permalink( self::$post_id )
);
- $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) );
+ $this->assertSame( $expected, wp_get_canonical_url( self::$post_id ) );
}
/**
@@ -87,7 +87,7 @@ class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
$expected = trailingslashit( get_permalink( self::$post_id ) ) . user_trailingslashit( $page, 'single_paged' );
- $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) );
+ $this->assertSame( $expected, wp_get_canonical_url( self::$post_id ) );
}
/**
@@ -113,7 +113,7 @@ class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
get_permalink( self::$post_id ) . '#comments'
);
- $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) );
+ $this->assertSame( $expected, wp_get_canonical_url( self::$post_id ) );
}
/**
@@ -137,7 +137,7 @@ class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
$expected = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . $wp_rewrite->comments_pagination_base . '-' . $cpage, 'commentpaged' ) . '#comments';
- $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) );
+ $this->assertSame( $expected, wp_get_canonical_url( self::$post_id ) );
}
/**
@@ -148,7 +148,7 @@ class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
$canonical_url = wp_get_canonical_url( self::$post_id );
remove_filter( 'get_canonical_url', array( $this, 'canonical_url_filter' ) );
- $this->assertEquals( $this->canonical_url_filter(), $canonical_url );
+ $this->assertSame( $this->canonical_url_filter(), $canonical_url );
}
/**
diff --git a/tests/phpunit/tests/locale.php b/tests/phpunit/tests/locale.php
index 9790ca14bf..a51df0a5b4 100644
--- a/tests/phpunit/tests/locale.php
+++ b/tests/phpunit/tests/locale.php
@@ -16,13 +16,13 @@ class Tests_Locale extends WP_UnitTestCase {
}
public function test_get_weekday() {
- $this->assertEquals( __( 'Sunday' ), $this->locale->get_weekday( 0 ) );
- $this->assertEquals( __( 'Monday' ), $this->locale->get_weekday( 1 ) );
- $this->assertEquals( __( 'Tuesday' ), $this->locale->get_weekday( 2 ) );
- $this->assertEquals( __( 'Wednesday' ), $this->locale->get_weekday( 3 ) );
- $this->assertEquals( __( 'Thursday' ), $this->locale->get_weekday( 4 ) );
- $this->assertEquals( __( 'Friday' ), $this->locale->get_weekday( 5 ) );
- $this->assertEquals( __( 'Saturday' ), $this->locale->get_weekday( 6 ) );
+ $this->assertSame( __( 'Sunday' ), $this->locale->get_weekday( 0 ) );
+ $this->assertSame( __( 'Monday' ), $this->locale->get_weekday( 1 ) );
+ $this->assertSame( __( 'Tuesday' ), $this->locale->get_weekday( 2 ) );
+ $this->assertSame( __( 'Wednesday' ), $this->locale->get_weekday( 3 ) );
+ $this->assertSame( __( 'Thursday' ), $this->locale->get_weekday( 4 ) );
+ $this->assertSame( __( 'Friday' ), $this->locale->get_weekday( 5 ) );
+ $this->assertSame( __( 'Saturday' ), $this->locale->get_weekday( 6 ) );
}
/**
@@ -33,72 +33,72 @@ class Tests_Locale extends WP_UnitTestCase {
}
public function test_get_weekday_initial() {
- $this->assertEquals( __( 'S' ), $this->locale->get_weekday_initial( __( 'Sunday' ) ) );
- $this->assertEquals( __( 'M' ), $this->locale->get_weekday_initial( __( 'Monday' ) ) );
- $this->assertEquals( __( 'T' ), $this->locale->get_weekday_initial( __( 'Tuesday' ) ) );
- $this->assertEquals( __( 'W' ), $this->locale->get_weekday_initial( __( 'Wednesday' ) ) );
- $this->assertEquals( __( 'T' ), $this->locale->get_weekday_initial( __( 'Thursday' ) ) );
- $this->assertEquals( __( 'F' ), $this->locale->get_weekday_initial( __( 'Friday' ) ) );
- $this->assertEquals( __( 'S' ), $this->locale->get_weekday_initial( __( 'Saturday' ) ) );
+ $this->assertSame( __( 'S' ), $this->locale->get_weekday_initial( __( 'Sunday' ) ) );
+ $this->assertSame( __( 'M' ), $this->locale->get_weekday_initial( __( 'Monday' ) ) );
+ $this->assertSame( __( 'T' ), $this->locale->get_weekday_initial( __( 'Tuesday' ) ) );
+ $this->assertSame( __( 'W' ), $this->locale->get_weekday_initial( __( 'Wednesday' ) ) );
+ $this->assertSame( __( 'T' ), $this->locale->get_weekday_initial( __( 'Thursday' ) ) );
+ $this->assertSame( __( 'F' ), $this->locale->get_weekday_initial( __( 'Friday' ) ) );
+ $this->assertSame( __( 'S' ), $this->locale->get_weekday_initial( __( 'Saturday' ) ) );
}
public function test_get_weekday_abbrev() {
- $this->assertEquals( __( 'Sun' ), $this->locale->get_weekday_abbrev( __( 'Sunday' ) ) );
- $this->assertEquals( __( 'Mon' ), $this->locale->get_weekday_abbrev( __( 'Monday' ) ) );
- $this->assertEquals( __( 'Tue' ), $this->locale->get_weekday_abbrev( __( 'Tuesday' ) ) );
- $this->assertEquals( __( 'Wed' ), $this->locale->get_weekday_abbrev( __( 'Wednesday' ) ) );
- $this->assertEquals( __( 'Thu' ), $this->locale->get_weekday_abbrev( __( 'Thursday' ) ) );
- $this->assertEquals( __( 'Fri' ), $this->locale->get_weekday_abbrev( __( 'Friday' ) ) );
- $this->assertEquals( __( 'Sat' ), $this->locale->get_weekday_abbrev( __( 'Saturday' ) ) );
+ $this->assertSame( __( 'Sun' ), $this->locale->get_weekday_abbrev( __( 'Sunday' ) ) );
+ $this->assertSame( __( 'Mon' ), $this->locale->get_weekday_abbrev( __( 'Monday' ) ) );
+ $this->assertSame( __( 'Tue' ), $this->locale->get_weekday_abbrev( __( 'Tuesday' ) ) );
+ $this->assertSame( __( 'Wed' ), $this->locale->get_weekday_abbrev( __( 'Wednesday' ) ) );
+ $this->assertSame( __( 'Thu' ), $this->locale->get_weekday_abbrev( __( 'Thursday' ) ) );
+ $this->assertSame( __( 'Fri' ), $this->locale->get_weekday_abbrev( __( 'Friday' ) ) );
+ $this->assertSame( __( 'Sat' ), $this->locale->get_weekday_abbrev( __( 'Saturday' ) ) );
}
public function test_get_month() {
- $this->assertEquals( __( 'January' ), $this->locale->get_month( 1 ) );
- $this->assertEquals( __( 'February' ), $this->locale->get_month( 2 ) );
- $this->assertEquals( __( 'March' ), $this->locale->get_month( 3 ) );
- $this->assertEquals( __( 'April' ), $this->locale->get_month( 4 ) );
- $this->assertEquals( __( 'May' ), $this->locale->get_month( 5 ) );
- $this->assertEquals( __( 'June' ), $this->locale->get_month( 6 ) );
- $this->assertEquals( __( 'July' ), $this->locale->get_month( 7 ) );
- $this->assertEquals( __( 'August' ), $this->locale->get_month( 8 ) );
- $this->assertEquals( __( 'September' ), $this->locale->get_month( 9 ) );
- $this->assertEquals( __( 'October' ), $this->locale->get_month( 10 ) );
- $this->assertEquals( __( 'November' ), $this->locale->get_month( 11 ) );
- $this->assertEquals( __( 'December' ), $this->locale->get_month( 12 ) );
+ $this->assertSame( __( 'January' ), $this->locale->get_month( 1 ) );
+ $this->assertSame( __( 'February' ), $this->locale->get_month( 2 ) );
+ $this->assertSame( __( 'March' ), $this->locale->get_month( 3 ) );
+ $this->assertSame( __( 'April' ), $this->locale->get_month( 4 ) );
+ $this->assertSame( __( 'May' ), $this->locale->get_month( 5 ) );
+ $this->assertSame( __( 'June' ), $this->locale->get_month( 6 ) );
+ $this->assertSame( __( 'July' ), $this->locale->get_month( 7 ) );
+ $this->assertSame( __( 'August' ), $this->locale->get_month( 8 ) );
+ $this->assertSame( __( 'September' ), $this->locale->get_month( 9 ) );
+ $this->assertSame( __( 'October' ), $this->locale->get_month( 10 ) );
+ $this->assertSame( __( 'November' ), $this->locale->get_month( 11 ) );
+ $this->assertSame( __( 'December' ), $this->locale->get_month( 12 ) );
}
public function test_get_month_leading_zero() {
- $this->assertEquals( __( 'January' ), $this->locale->get_month( '01' ) );
- $this->assertEquals( __( 'February' ), $this->locale->get_month( '02' ) );
- $this->assertEquals( __( 'March' ), $this->locale->get_month( '03' ) );
- $this->assertEquals( __( 'April' ), $this->locale->get_month( '04' ) );
- $this->assertEquals( __( 'May' ), $this->locale->get_month( '05' ) );
- $this->assertEquals( __( 'June' ), $this->locale->get_month( '06' ) );
- $this->assertEquals( __( 'July' ), $this->locale->get_month( '07' ) );
- $this->assertEquals( __( 'August' ), $this->locale->get_month( '08' ) );
- $this->assertEquals( __( 'September' ), $this->locale->get_month( '09' ) );
+ $this->assertSame( __( 'January' ), $this->locale->get_month( '01' ) );
+ $this->assertSame( __( 'February' ), $this->locale->get_month( '02' ) );
+ $this->assertSame( __( 'March' ), $this->locale->get_month( '03' ) );
+ $this->assertSame( __( 'April' ), $this->locale->get_month( '04' ) );
+ $this->assertSame( __( 'May' ), $this->locale->get_month( '05' ) );
+ $this->assertSame( __( 'June' ), $this->locale->get_month( '06' ) );
+ $this->assertSame( __( 'July' ), $this->locale->get_month( '07' ) );
+ $this->assertSame( __( 'August' ), $this->locale->get_month( '08' ) );
+ $this->assertSame( __( 'September' ), $this->locale->get_month( '09' ) );
}
public function test_get_month_abbrev() {
- $this->assertEquals( __( 'Jan' ), $this->locale->get_month_abbrev( __( 'January' ) ) );
- $this->assertEquals( __( 'Feb' ), $this->locale->get_month_abbrev( __( 'February' ) ) );
- $this->assertEquals( __( 'Mar' ), $this->locale->get_month_abbrev( __( 'March' ) ) );
- $this->assertEquals( __( 'Apr' ), $this->locale->get_month_abbrev( __( 'April' ) ) );
- $this->assertEquals( __( 'May' ), $this->locale->get_month_abbrev( __( 'May' ) ) );
- $this->assertEquals( __( 'Jun' ), $this->locale->get_month_abbrev( __( 'June' ) ) );
- $this->assertEquals( __( 'Jul' ), $this->locale->get_month_abbrev( __( 'July' ) ) );
- $this->assertEquals( __( 'Aug' ), $this->locale->get_month_abbrev( __( 'August' ) ) );
- $this->assertEquals( __( 'Sep' ), $this->locale->get_month_abbrev( __( 'September' ) ) );
- $this->assertEquals( __( 'Oct' ), $this->locale->get_month_abbrev( __( 'October' ) ) );
- $this->assertEquals( __( 'Nov' ), $this->locale->get_month_abbrev( __( 'November' ) ) );
- $this->assertEquals( __( 'Dec' ), $this->locale->get_month_abbrev( __( 'December' ) ) );
+ $this->assertSame( __( 'Jan' ), $this->locale->get_month_abbrev( __( 'January' ) ) );
+ $this->assertSame( __( 'Feb' ), $this->locale->get_month_abbrev( __( 'February' ) ) );
+ $this->assertSame( __( 'Mar' ), $this->locale->get_month_abbrev( __( 'March' ) ) );
+ $this->assertSame( __( 'Apr' ), $this->locale->get_month_abbrev( __( 'April' ) ) );
+ $this->assertSame( __( 'May' ), $this->locale->get_month_abbrev( __( 'May' ) ) );
+ $this->assertSame( __( 'Jun' ), $this->locale->get_month_abbrev( __( 'June' ) ) );
+ $this->assertSame( __( 'Jul' ), $this->locale->get_month_abbrev( __( 'July' ) ) );
+ $this->assertSame( __( 'Aug' ), $this->locale->get_month_abbrev( __( 'August' ) ) );
+ $this->assertSame( __( 'Sep' ), $this->locale->get_month_abbrev( __( 'September' ) ) );
+ $this->assertSame( __( 'Oct' ), $this->locale->get_month_abbrev( __( 'October' ) ) );
+ $this->assertSame( __( 'Nov' ), $this->locale->get_month_abbrev( __( 'November' ) ) );
+ $this->assertSame( __( 'Dec' ), $this->locale->get_month_abbrev( __( 'December' ) ) );
}
public function test_get_meridiem() {
- $this->assertEquals( __( 'am' ), $this->locale->get_meridiem( 'am' ) );
- $this->assertEquals( __( 'AM' ), $this->locale->get_meridiem( 'AM' ) );
- $this->assertEquals( __( 'pm' ), $this->locale->get_meridiem( 'pm' ) );
- $this->assertEquals( __( 'PM' ), $this->locale->get_meridiem( 'PM' ) );
+ $this->assertSame( __( 'am' ), $this->locale->get_meridiem( 'am' ) );
+ $this->assertSame( __( 'AM' ), $this->locale->get_meridiem( 'AM' ) );
+ $this->assertSame( __( 'pm' ), $this->locale->get_meridiem( 'pm' ) );
+ $this->assertSame( __( 'PM' ), $this->locale->get_meridiem( 'PM' ) );
}
public function test_is_rtl() {
diff --git a/tests/phpunit/tests/mail.php b/tests/phpunit/tests/mail.php
index f520e1e5a0..25d6fa3058 100644
--- a/tests/phpunit/tests/mail.php
+++ b/tests/phpunit/tests/mail.php
@@ -80,7 +80,7 @@ class Tests_Mail extends WP_UnitTestCase {
$mailer = tests_retrieve_phpmailer_instance();
// We need some better assertions here but these catch the failure for now.
- $this->assertEqualsIgnoreEOL( $body, $mailer->get_sent()->body );
+ $this->assertSameIgnoreEOL( $body, $mailer->get_sent()->body );
$this->assertTrue( strpos( iconv_mime_decode_headers( ( $mailer->get_sent()->header ) )['Content-Type'][0], 'boundary="----=_Part_4892_25692638.1192452070893"' ) > 0 );
$this->assertTrue( strpos( $mailer->get_sent()->header, 'charset=' ) > 0 );
}
@@ -106,13 +106,13 @@ class Tests_Mail extends WP_UnitTestCase {
// Retrieve the mailer instance.
$mailer = tests_retrieve_phpmailer_instance();
- $this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
- $this->assertEquals( 'Name', $mailer->get_recipient( 'to' )->name );
- $this->assertEquals( 'cc@cc.com', $mailer->get_recipient( 'cc' )->address );
- $this->assertEquals( 'The Carbon Guy', $mailer->get_recipient( 'cc' )->name );
- $this->assertEquals( 'bcc@bcc.com', $mailer->get_recipient( 'bcc' )->address );
- $this->assertEquals( 'The Blind Carbon Guy', $mailer->get_recipient( 'bcc' )->name );
- $this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
+ $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
+ $this->assertSame( 'Name', $mailer->get_recipient( 'to' )->name );
+ $this->assertSame( 'cc@cc.com', $mailer->get_recipient( 'cc' )->address );
+ $this->assertSame( 'The Carbon Guy', $mailer->get_recipient( 'cc' )->name );
+ $this->assertSame( 'bcc@bcc.com', $mailer->get_recipient( 'bcc' )->address );
+ $this->assertSame( 'The Blind Carbon Guy', $mailer->get_recipient( 'bcc' )->name );
+ $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
}
/**
@@ -128,11 +128,11 @@ class Tests_Mail extends WP_UnitTestCase {
// WordPress 3.2 and later correctly split the address into the two parts and send them separately to PHPMailer.
// Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
$mailer = tests_retrieve_phpmailer_instance();
- $this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
- $this->assertEquals( 'Name', $mailer->get_recipient( 'to' )->name );
- $this->assertEquals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
- $this->assertEquals( 'Another Name', $mailer->get_recipient( 'to', 0, 1 )->name );
- $this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
+ $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
+ $this->assertSame( 'Name', $mailer->get_recipient( 'to' )->name );
+ $this->assertSame( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
+ $this->assertSame( 'Another Name', $mailer->get_recipient( 'to', 0, 1 )->name );
+ $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
}
function test_wp_mail_multiple_to_addresses() {
@@ -143,9 +143,9 @@ class Tests_Mail extends WP_UnitTestCase {
wp_mail( $to, $subject, $message );
$mailer = tests_retrieve_phpmailer_instance();
- $this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
- $this->assertEquals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
- $this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
+ $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
+ $this->assertSame( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
+ $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
}
/**
@@ -159,8 +159,8 @@ class Tests_Mail extends WP_UnitTestCase {
wp_mail( $to, $subject, $message );
$mailer = tests_retrieve_phpmailer_instance();
- $this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
- $this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
+ $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
+ $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
}
/**
@@ -286,7 +286,7 @@ class Tests_Mail extends WP_UnitTestCase {
wp_mail( $to, $subject, $message, $headers );
$mailer = tests_retrieve_phpmailer_instance();
- $this->assertEquals( 1, substr_count( $mailer->get_sent()->header, $expected ) );
+ $this->assertSame( 1, substr_count( $mailer->get_sent()->header, $expected ) );
}
function wp_mail_quoted_printable( $mailer ) {
@@ -354,7 +354,7 @@ class Tests_Mail extends WP_UnitTestCase {
foreach ( $headers as $header => $value ) {
$target_headers = preg_grep( "/^$header:/", $sent_headers );
- $this->assertEquals( $expected[ $header ], array_pop( $target_headers ) );
+ $this->assertSame( $expected[ $header ], array_pop( $target_headers ) );
}
}
@@ -373,7 +373,7 @@ class Tests_Mail extends WP_UnitTestCase {
$mailer = tests_retrieve_phpmailer_instance();
- $this->assertEquals( '', $mailer->Sender );
+ $this->assertSame( '', $mailer->Sender );
}
/**
@@ -389,7 +389,7 @@ class Tests_Mail extends WP_UnitTestCase {
wp_mail( $to, $subject, $message );
- $this->assertEquals( 1, $ma->get_call_count() );
+ $this->assertSame( 1, $ma->get_call_count() );
$expected_error_data = array(
'to' => array( 'an_invalid_address' ),
@@ -404,8 +404,8 @@ class Tests_Mail extends WP_UnitTestCase {
$all_args = $ma->get_args();
$call_args = array_pop( $all_args );
- $this->assertEquals( 'wp_mail_failed', $call_args[0]->get_error_code() );
- $this->assertEquals( $expected_error_data, $call_args[0]->get_error_data() );
+ $this->assertSame( 'wp_mail_failed', $call_args[0]->get_error_code() );
+ $this->assertSame( $expected_error_data, $call_args[0]->get_error_data() );
}
/**
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index 09f3003773..9131ab2cdb 100644
--- a/tests/phpunit/tests/media.php
+++ b/tests/phpunit/tests/media.php
@@ -48,8 +48,8 @@ CAP;
function test_img_caption_shortcode_added() {
global $shortcode_tags;
- $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
- $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
+ $this->assertSame( 'img_caption_shortcode', $shortcode_tags['caption'] );
+ $this->assertSame( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
}
function test_img_caption_shortcode_with_empty_params() {
@@ -62,7 +62,7 @@ CAP;
*/
function test_img_caption_shortcode_with_empty_params_but_content() {
$result = img_caption_shortcode( array(), $this->caption );
- $this->assertEquals( $this->caption, $result );
+ $this->assertSame( $this->caption, $result );
}
/**
@@ -72,7 +72,7 @@ CAP;
add_filter( 'img_caption_shortcode', array( $this, '_return_alt_caption' ) );
$result = img_caption_shortcode( array(), $this->caption );
- $this->assertEquals( $this->alternate_caption, $result );
+ $this->assertSame( $this->alternate_caption, $result );
}
/**
@@ -92,7 +92,7 @@ CAP;
),
$this->caption
);
- $this->assertEquals( $this->caption, $result );
+ $this->assertSame( $this->caption, $result );
}
/**
@@ -117,7 +117,7 @@ CAP;
),
$this->caption
);
- $this->assertEquals( $this->caption, $result );
+ $this->assertSame( $this->caption, $result );
}
function test_img_caption_shortcode_with_old_format() {
@@ -128,14 +128,14 @@ CAP;
)
);
- $this->assertEquals( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( '/alignnone/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
+ $this->assertSame( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/alignnone/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
if ( current_theme_supports( 'html5', 'caption' ) ) {
- $this->assertEquals( 1, preg_match_all( '/width: 20/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/width: 20/', $result, $_r ) );
} else {
- $this->assertEquals( 1, preg_match_all( '/width: 30/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/width: 30/', $result, $_r ) );
}
}
@@ -148,9 +148,9 @@ CAP;
'align' => '&myAlignment',
)
);
- $this->assertEquals( 1, preg_match_all( '/wp-caption &myAlignment/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( '/id="myId"/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/wp-caption &myAlignment/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/id="myId"/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
}
function test_img_caption_shortcode_with_old_format_and_class() {
@@ -161,7 +161,7 @@ CAP;
'caption' => $this->caption,
)
);
- $this->assertEquals( 1, preg_match_all( '/wp-caption alignnone some-class another-class/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/wp-caption alignnone some-class another-class/', $result, $_r ) );
}
@@ -174,7 +174,7 @@ CAP;
);
$our_preg = preg_quote( $this->html_content );
- $this->assertEquals( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) );
}
function test_new_img_caption_shortcode_new_format() {
@@ -185,8 +185,8 @@ CAP;
$img_preg = preg_quote( $this->img_content );
$content_preg = preg_quote( $this->html_content );
- $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
}
function test_new_img_caption_shortcode_new_format_and_linked_image() {
@@ -198,8 +198,8 @@ CAP;
$img_preg = preg_quote( $linked_image );
$content_preg = preg_quote( $this->html_content );
- $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
}
function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
@@ -211,8 +211,8 @@ CAP;
$img_preg = preg_quote( $linked_image );
$content_preg = preg_quote( $this->html_content );
- $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
}
/**
@@ -227,7 +227,7 @@ CAP;
$this->img_content . $this->html_content
);
- $this->assertEquals( 1, preg_match_all( '/aria-describedby="caption-myId"/', $result, $_r ) );
+ $this->assertSame( 1, preg_match_all( '/aria-describedby="caption-myId"/', $result, $_r ) );
}
function test_add_remove_oembed_provider() {
@@ -245,7 +245,7 @@ CAP;
$content = '';
$result = $wp_embed->autoembed( $content );
- $this->assertEquals( $content, $result );
+ $this->assertSame( $content, $result );
}
/**
@@ -267,7 +267,7 @@ http://some.other.link/
EOF;
$result = $wp_embed->autoembed( $content );
- $this->assertEquals( $content, $result );
+ $this->assertSame( $content, $result );
}
function data_autoembed() {
@@ -333,7 +333,7 @@ https://w.org',
function test_autoembed( $content, $result = null ) {
$wp_embed = new Test_Autoembed;
- $this->assertEquals( $wp_embed->autoembed( $content ), $result ? $result : $content );
+ $this->assertSame( $wp_embed->autoembed( $content ), $result ? $result : $content );
}
function test_wp_prepare_attachment_for_js() {
@@ -350,31 +350,31 @@ https://w.org',
$prepped = wp_prepare_attachment_for_js( $post );
$this->assertInternalType( 'array', $prepped );
- $this->assertEquals( 0, $prepped['uploadedTo'] );
- $this->assertEquals( '', $prepped['mime'] );
- $this->assertEquals( '', $prepped['type'] );
- $this->assertEquals( '', $prepped['subtype'] );
+ $this->assertSame( 0, $prepped['uploadedTo'] );
+ $this->assertSame( '', $prepped['mime'] );
+ $this->assertSame( '', $prepped['type'] );
+ $this->assertSame( '', $prepped['subtype'] );
// #21963, there will be a GUID always, so there will be a URL.
$this->assertNotEquals( '', $prepped['url'] );
- $this->assertEquals( site_url( 'wp-includes/images/media/default.png' ), $prepped['icon'] );
+ $this->assertSame( site_url( 'wp-includes/images/media/default.png' ), $prepped['icon'] );
// Fake a mime.
$post->post_mime_type = 'image/jpeg';
$prepped = wp_prepare_attachment_for_js( $post );
- $this->assertEquals( 'image/jpeg', $prepped['mime'] );
- $this->assertEquals( 'image', $prepped['type'] );
- $this->assertEquals( 'jpeg', $prepped['subtype'] );
+ $this->assertSame( 'image/jpeg', $prepped['mime'] );
+ $this->assertSame( 'image', $prepped['type'] );
+ $this->assertSame( 'jpeg', $prepped['subtype'] );
// Fake a mime without a slash. See #WP22532.
$post->post_mime_type = 'image';
$prepped = wp_prepare_attachment_for_js( $post );
- $this->assertEquals( 'image', $prepped['mime'] );
- $this->assertEquals( 'image', $prepped['type'] );
- $this->assertEquals( '', $prepped['subtype'] );
+ $this->assertSame( 'image', $prepped['mime'] );
+ $this->assertSame( 'image', $prepped['type'] );
+ $this->assertSame( '', $prepped['subtype'] );
// Test that if author is not found, we return "(no author)" as `display_name`.
// The previously used test post contains no author, so we can reuse it.
- $this->assertEquals( '(no author)', $prepped['authorName'] );
+ $this->assertSame( '(no author)', $prepped['authorName'] );
// Test that if author has HTML entities in display_name, they're decoded correctly.
$html_entity_author = self::factory()->user->create(
@@ -384,7 +384,7 @@ https://w.org',
);
$post->post_author = $html_entity_author;
$prepped = wp_prepare_attachment_for_js( $post );
- $this->assertEquals( 'You & Me', $prepped['authorName'] );
+ $this->assertSame( 'You & Me', $prepped['authorName'] );
}
/**
@@ -428,15 +428,15 @@ https://w.org',
$tb = $gb * 1024;
// Test if boundaries are correct.
- $this->assertEquals( '1TB', wp_convert_bytes_to_hr( $tb ) );
- $this->assertEquals( '1GB', wp_convert_bytes_to_hr( $gb ) );
- $this->assertEquals( '1MB', wp_convert_bytes_to_hr( $mb ) );
- $this->assertEquals( '1KB', wp_convert_bytes_to_hr( $kb ) );
+ $this->assertSame( '1TB', wp_convert_bytes_to_hr( $tb ) );
+ $this->assertSame( '1GB', wp_convert_bytes_to_hr( $gb ) );
+ $this->assertSame( '1MB', wp_convert_bytes_to_hr( $mb ) );
+ $this->assertSame( '1KB', wp_convert_bytes_to_hr( $kb ) );
- $this->assertEquals( '1 TB', size_format( $tb ) );
- $this->assertEquals( '1 GB', size_format( $gb ) );
- $this->assertEquals( '1 MB', size_format( $mb ) );
- $this->assertEquals( '1 KB', size_format( $kb ) );
+ $this->assertSame( '1 TB', size_format( $tb ) );
+ $this->assertSame( '1 GB', size_format( $gb ) );
+ $this->assertSame( '1 MB', size_format( $mb ) );
+ $this->assertSame( '1 KB', size_format( $kb ) );
// Now some values around.
$hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb );
@@ -452,8 +452,8 @@ https://w.org',
$this->assertEquals( 1022.99902344, (float) str_replace( ',', '.', $hr ), 'The values should be equal', 0.0001 );
// Edge.
- $this->assertEquals( '-1B', wp_convert_bytes_to_hr( -1 ) );
- $this->assertEquals( '0B', wp_convert_bytes_to_hr( 0 ) );
+ $this->assertSame( '-1B', wp_convert_bytes_to_hr( -1 ) );
+ $this->assertSame( '0B', wp_convert_bytes_to_hr( 0 ) );
}
/**
@@ -522,7 +522,7 @@ https://w.org',
BLOB;
$post_id = self::factory()->post->create( array( 'post_content' => $blob ) );
$srcs = get_post_galleries_images( $post_id );
- $this->assertEquals( $srcs, array( $ids1_srcs, $ids2_srcs ) );
+ $this->assertSame( $srcs, array( $ids1_srcs, $ids2_srcs ) );
}
/**
@@ -672,7 +672,7 @@ BLOB;
BLOB;
$post_id = self::factory()->post->create( array( 'post_content' => $blob ) );
$srcs = get_post_gallery_images( $post_id );
- $this->assertEquals( $srcs, $ids1_srcs );
+ $this->assertSame( $srcs, $ids1_srcs );
}
function test_get_media_embedded_in_content() {
@@ -721,22 +721,22 @@ CONTENT;
$contents = array_values( compact( $types ) );
$matches = get_media_embedded_in_content( $content, 'audio' );
- $this->assertEquals( array( $audio ), $matches );
+ $this->assertSame( array( $audio ), $matches );
$matches = get_media_embedded_in_content( $content, 'video' );
- $this->assertEquals( array( $video ), $matches );
+ $this->assertSame( array( $video ), $matches );
$matches = get_media_embedded_in_content( $content, 'object' );
- $this->assertEquals( array( $object ), $matches );
+ $this->assertSame( array( $object ), $matches );
$matches = get_media_embedded_in_content( $content, 'embed' );
- $this->assertEquals( array( $embed ), $matches );
+ $this->assertSame( array( $embed ), $matches );
$matches = get_media_embedded_in_content( $content, 'iframe' );
- $this->assertEquals( array( $iframe ), $matches );
+ $this->assertSame( array( $iframe ), $matches );
$matches = get_media_embedded_in_content( $content, $types );
- $this->assertEquals( $contents, $matches );
+ $this->assertSame( $contents, $matches );
}
function test_get_media_embedded_in_content_order() {
@@ -753,11 +753,11 @@ VIDEO;
$content = $audio . $video;
$matches1 = get_media_embedded_in_content( $content, array( 'audio', 'video' ) );
- $this->assertEquals( array( $audio, $video ), $matches1 );
+ $this->assertSame( array( $audio, $video ), $matches1 );
$reversed = $video . $audio;
$matches2 = get_media_embedded_in_content( $reversed, array( 'audio', 'video' ) );
- $this->assertEquals( array( $video, $audio ), $matches2 );
+ $this->assertSame( array( $video, $audio ), $matches2 );
}
/**
@@ -859,7 +859,7 @@ VIDEO;
'' .
"http://domain.tld/wp-content/uploads/2013/12/xyz.mp4\n";
- $this->assertEquals( $expected, $content );
+ $this->assertSame( $expected, $content );
}
/**
@@ -1016,8 +1016,8 @@ VIDEO;
remove_image_size( 'test-size' );
$this->assertArrayHasKey( 'test-size', $sizes );
- $this->assertEquals( 200, $sizes['test-size']['width'] );
- $this->assertEquals( 600, $sizes['test-size']['height'] );
+ $this->assertSame( 200, $sizes['test-size']['width'] );
+ $this->assertSame( 600, $sizes['test-size']['height'] );
}
/**
@@ -1056,7 +1056,7 @@ VIDEO;
);
$image_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_path;
- $this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) );
+ $this->assertSame( $attachment_id, attachment_url_to_postid( $image_url ) );
}
/**
@@ -1074,7 +1074,7 @@ VIDEO;
);
$image_url = 'https://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_path;
- $this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) );
+ $this->assertSame( $attachment_id, attachment_url_to_postid( $image_url ) );
}
/**
@@ -1102,7 +1102,7 @@ VIDEO;
);
$image_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_path_upper_case;
- $this->assertEquals( $attachment_id_upper_case, attachment_url_to_postid( $image_url ) );
+ $this->assertSame( $attachment_id_upper_case, attachment_url_to_postid( $image_url ) );
}
function test_attachment_url_to_postid_filtered() {
@@ -1118,7 +1118,7 @@ VIDEO;
add_filter( 'upload_dir', array( $this, '_upload_dir' ) );
$image_url = 'http://192.168.1.20.com/wp-content/uploads/' . $image_path;
- $this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) );
+ $this->assertSame( $attachment_id, attachment_url_to_postid( $image_url ) );
remove_filter( 'upload_dir', array( $this, '_upload_dir' ) );
}
@@ -1133,7 +1133,7 @@ VIDEO;
function test_attachment_url_to_postid_with_empty_url() {
$post_id = attachment_url_to_postid( '' );
$this->assertInternalType( 'int', $post_id );
- $this->assertEquals( 0, $post_id );
+ $this->assertSame( 0, $post_id );
}
/**
@@ -1172,7 +1172,7 @@ VIDEO;
// Clean up.
wp_delete_attachment( $post_id );
- $this->assertEquals( 'This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $post->post_excerpt );
+ $this->assertSame( 'This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $post->post_excerpt );
}
/**
@@ -1211,7 +1211,7 @@ VIDEO;
// Clean up.
wp_delete_attachment( $post_id );
- $this->assertEquals( 'This is a test', $post->post_title );
+ $this->assertSame( 'This is a test', $post->post_title );
}
/**
@@ -1228,7 +1228,7 @@ _my_function('data');
EOF;
$result = $wp_embed->autoembed( $content );
- $this->assertEquals( $content, $result );
+ $this->assertSame( $content, $result );
}
/**
@@ -1244,7 +1244,7 @@ my_function();
EOF;
$result = $wp_embed->autoembed( $content );
- $this->assertEquals( $content, $result );
+ $this->assertSame( $content, $result );
}
@@ -1278,7 +1278,7 @@ Stop.
EOF;
$result = apply_filters( 'the_content', $content );
- $this->assertEqualsIgnoreEOL( $expected, $result );
+ $this->assertSameIgnoreEOL( $expected, $result );
}
/**
@@ -1307,7 +1307,7 @@ EOF;
EOF;
$result = $wp_embed->autoembed( $content );
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
$content = <<https://www.example.com/?video=1
@@ -1321,7 +1321,7 @@ do not break this';
EOF;
$result = $wp_embed->autoembed( $content );
- $this->assertEquals( $content, $result );
+ $this->assertSame( $content, $result );
remove_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10 );
}
@@ -1340,7 +1340,7 @@ EOF;
$image[0]
);
- $this->assertEquals( $expected, wp_get_attachment_image( self::$large_id ) );
+ $this->assertSame( $expected, wp_get_attachment_image( self::$large_id ) );
}
/**
@@ -1360,7 +1360,7 @@ EOF;
$image[0]
);
- $this->assertEquals( $expected, wp_get_attachment_image( self::$large_id ) );
+ $this->assertSame( $expected, wp_get_attachment_image( self::$large_id ) );
// Cleanup.
update_post_meta( self::$large_id, '_wp_attachment_image_alt', '', true );
@@ -1384,7 +1384,7 @@ EOF;
$image = wp_get_attachment_image_src( $attachment_id, 'thumbnail', false );
- $this->assertEquals( $image[0], wp_get_attachment_image_url( $attachment_id ) );
+ $this->assertSame( $image[0], wp_get_attachment_image_url( $attachment_id ) );
}
/**
@@ -1408,7 +1408,7 @@ EOF;
$this->assertFalse( wp_get_attachment_caption( $post_id ) );
- $this->assertEquals( $caption, wp_get_attachment_caption( $attachment_id ) );
+ $this->assertSame( $caption, wp_get_attachment_caption( $attachment_id ) );
}
/**
@@ -1426,7 +1426,7 @@ EOF;
)
);
- $this->assertEquals( '', wp_get_attachment_caption( $attachment_id ) );
+ $this->assertSame( '', wp_get_attachment_caption( $attachment_id ) );
}
/**
@@ -2387,7 +2387,7 @@ EOF;
$attachment_id = wp_insert_attachment( $data, '', 0, true );
$this->assertWPError( $attachment_id );
- $this->assertEquals( 'invalid_date', $attachment_id->get_error_code() );
+ $this->assertSame( 'invalid_date', $attachment_id->get_error_code() );
$attachment_id = wp_insert_attachment( $data, '', 0 );
$this->assertSame( 0, $attachment_id );
@@ -2406,7 +2406,7 @@ EOF;
),
);
- $this->assertEquals( 123, wp_get_media_creation_timestamp( $metadata ) );
+ $this->assertSame( 123, wp_get_media_creation_timestamp( $metadata ) );
}
/**
@@ -2424,7 +2424,7 @@ EOF;
),
);
- $this->assertEquals( 1450978809, wp_get_media_creation_timestamp( $metadata ) );
+ $this->assertSame( 1450978809, wp_get_media_creation_timestamp( $metadata ) );
}
/**
@@ -2444,7 +2444,7 @@ EOF;
),
);
- $this->assertEquals( 1450978805, wp_get_media_creation_timestamp( $metadata ) );
+ $this->assertSame( 1450978805, wp_get_media_creation_timestamp( $metadata ) );
}
/**
@@ -2462,7 +2462,7 @@ EOF;
),
);
- $this->assertEquals( 1265680539, wp_get_media_creation_timestamp( $metadata ) );
+ $this->assertSame( 1265680539, wp_get_media_creation_timestamp( $metadata ) );
}
/**
@@ -2477,7 +2477,7 @@ EOF;
$video = DIR_TESTDATA . '/uploads/small-video.mp4';
$metadata = wp_read_audio_metadata( $video );
- $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
+ $this->assertSame( 1269120551, $metadata['created_timestamp'] );
}
/**
@@ -2487,7 +2487,7 @@ EOF;
$video = DIR_TESTDATA . '/uploads/small-video.mov';
$metadata = wp_read_video_metadata( $video );
- $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
+ $this->assertSame( 1269120551, $metadata['created_timestamp'] );
}
/**
@@ -2497,7 +2497,7 @@ EOF;
$video = DIR_TESTDATA . '/uploads/small-video.mp4';
$metadata = wp_read_video_metadata( $video );
- $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
+ $this->assertSame( 1269120551, $metadata['created_timestamp'] );
}
/**
@@ -2507,7 +2507,7 @@ EOF;
$video = DIR_TESTDATA . '/uploads/small-video.mkv';
$metadata = wp_read_video_metadata( $video );
- $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
+ $this->assertSame( 1269120551, $metadata['created_timestamp'] );
}
/**
@@ -2517,7 +2517,7 @@ EOF;
$video = DIR_TESTDATA . '/uploads/small-video.webm';
$metadata = wp_read_video_metadata( $video );
- $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
+ $this->assertSame( 1269120551, $metadata['created_timestamp'] );
}
/**
@@ -2969,7 +2969,7 @@ EOF;
'link' => 'file',
)
);
- $this->assertEquals( 2, substr_count( $actual, '.jpg' ) );
+ $this->assertSame( 2, substr_count( $actual, '.jpg' ) );
// None: Does not link.
$actual = gallery_shortcode(
diff --git a/tests/phpunit/tests/menu/nav-menu.php b/tests/phpunit/tests/menu/nav-menu.php
index 39e9ed4924..467b4ab930 100644
--- a/tests/phpunit/tests/menu/nav-menu.php
+++ b/tests/phpunit/tests/menu/nav-menu.php
@@ -44,7 +44,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
$expected_nav_menu_locations = array(
'primary' => 1,
);
- $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+ $this->assertSame( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
}
/**
@@ -66,7 +66,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
'primary' => 1,
'secondary' => 2,
);
- $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+ $this->assertSame( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
}
/**
@@ -85,7 +85,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
$new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $prev_theme_nav_menu_locations );
$expected_nav_menu_locations = $prev_theme_nav_menu_locations;
- $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+ $this->assertSame( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
}
/**
@@ -109,7 +109,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
$new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $prev_theme_nav_menu_locations );
$expected_nav_menu_locations = wp_array_slice_assoc( $prev_theme_nav_menu_locations, array_keys( get_registered_nav_menus() ) );
- $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+ $this->assertSame( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
}
/**
@@ -132,7 +132,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
'primary' => 1,
'secondary' => 2,
);
- $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+ $this->assertSame( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
}
/**
@@ -176,7 +176,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
'primary' => 1,
'main' => 2,
);
- $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+ $this->assertSame( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
}
/**
diff --git a/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php b/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
index 55b414876c..7d5c21fde8 100644
--- a/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
+++ b/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
@@ -25,7 +25,7 @@ class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase {
'yesorno' => 'yes',
);
- $this->assertEquals( $expected, $_POST );
+ $this->assertSame( $expected, $_POST );
}
public function test_multidimensional_nested_array_should_expand() {
@@ -55,7 +55,7 @@ class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase {
),
),
);
- $this->assertEquals( $expected, $_POST );
+ $this->assertSame( $expected, $_POST );
}
public function test_multidimensional_nested_array_should_expand_and_merge() {
@@ -100,6 +100,6 @@ class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase {
),
);
- $this->assertEquals( $expected, $_POST );
+ $this->assertSame( $expected, $_POST );
}
}
diff --git a/tests/phpunit/tests/meta.php b/tests/phpunit/tests/meta.php
index 30c154b982..d6869782f6 100644
--- a/tests/phpunit/tests/meta.php
+++ b/tests/phpunit/tests/meta.php
@@ -19,11 +19,11 @@ class Tests_Meta extends WP_UnitTestCase {
function test_sanitize_meta() {
$meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
- $this->assertEquals( 'unsanitized', $meta );
+ $this->assertSame( 'unsanitized', $meta );
register_meta( 'post', 'some_meta', array( $this, '_meta_sanitize_cb' ) );
$meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
- $this->assertEquals( 'sanitized', $meta );
+ $this->assertSame( 'sanitized', $meta );
}
function test_delete_metadata_by_mid() {
@@ -48,23 +48,23 @@ class Tests_Meta extends WP_UnitTestCase {
// Update the meta value.
$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value' ) );
$meta = get_metadata_by_mid( 'user', $this->meta_id );
- $this->assertEquals( 'meta_new_value', $meta->meta_value );
+ $this->assertSame( 'meta_new_value', $meta->meta_value );
// Update the meta value.
$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value', 'meta_new_key' ) );
$meta = get_metadata_by_mid( 'user', $this->meta_id );
- $this->assertEquals( 'meta_new_key', $meta->meta_key );
+ $this->assertSame( 'meta_new_key', $meta->meta_key );
// Update the key and value.
$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', 'meta_key' ) );
$meta = get_metadata_by_mid( 'user', $this->meta_id );
- $this->assertEquals( 'meta_key', $meta->meta_key );
- $this->assertEquals( 'meta_value', $meta->meta_value );
+ $this->assertSame( 'meta_key', $meta->meta_key );
+ $this->assertSame( 'meta_value', $meta->meta_value );
// Update the value that has to be serialized.
$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, array( 'first', 'second' ) ) );
$meta = get_metadata_by_mid( 'user', $this->meta_id );
- $this->assertEquals( array( 'first', 'second' ), $meta->meta_value );
+ $this->assertSame( array( 'first', 'second' ), $meta->meta_value );
// Let's try some invalid meta data.
$this->assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
@@ -137,13 +137,13 @@ class Tests_Meta extends WP_UnitTestCase {
)
);
- $this->assertEquals( 1, count( $u ) );
+ $this->assertSame( 1, count( $u ) );
// User found is not locally defined author (it's the admin).
$this->assertNotEquals( $this->author->user_login, $u[0]->user_login );
// Test EXISTS and NOT EXISTS together, no users should be found.
- $this->assertEquals(
+ $this->assertSame(
0,
count(
get_users(
@@ -163,7 +163,7 @@ class Tests_Meta extends WP_UnitTestCase {
)
);
- $this->assertEquals(
+ $this->assertSame(
2,
count(
get_users(
@@ -181,7 +181,7 @@ class Tests_Meta extends WP_UnitTestCase {
delete_metadata( 'user', $this->author->ID, 'meta_key' );
- $this->assertEquals(
+ $this->assertSame(
2,
count(
get_users(
@@ -208,24 +208,24 @@ class Tests_Meta extends WP_UnitTestCase {
$this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) );
$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value ) );
- $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
+ $this->assertSame( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value ) );
- $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
+ $this->assertSame( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertTrue( update_metadata( 'user', $this->author->ID, $key, 'blah' ) );
- $this->assertEquals( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) );
+ $this->assertSame( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
// Test overslashing.
$this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value2 ) );
- $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
+ $this->assertSame( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
$this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) );
- $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
+ $this->assertSame( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
}
/**
@@ -252,8 +252,8 @@ class Tests_Meta extends WP_UnitTestCase {
)
);
- $this->assertEquals( array( $post_id2, $post_id1 ), $posts->posts );
- $this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
+ $this->assertSame( array( $post_id2, $post_id1 ), $posts->posts );
+ $this->assertSame( 2, substr_count( $posts->request, 'CAST(' ) );
// Make sure the newer meta_query syntax behaves in a consistent way.
$posts = new WP_Query(
@@ -273,8 +273,8 @@ class Tests_Meta extends WP_UnitTestCase {
)
);
- $this->assertEquals( array( $post_id2, $post_id1 ), $posts->posts );
- $this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
+ $this->assertSame( array( $post_id2, $post_id1 ), $posts->posts );
+ $this->assertSame( 2, substr_count( $posts->request, 'CAST(' ) );
// The legacy `meta_key` value should take precedence.
$posts = new WP_Query(
@@ -297,8 +297,8 @@ class Tests_Meta extends WP_UnitTestCase {
)
);
- $this->assertEquals( array( $post_id2, $post_id1 ), $posts->posts );
- $this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
+ $this->assertSame( array( $post_id2, $post_id1 ), $posts->posts );
+ $this->assertSame( 2, substr_count( $posts->request, 'CAST(' ) );
}
function test_meta_cache_order_asc() {
@@ -310,7 +310,7 @@ class Tests_Meta extends WP_UnitTestCase {
foreach ( range( 1, 10 ) as $i ) {
$meta = get_post_meta( $post_id, 'color' );
- $this->assertEquals( $meta, $colors );
+ $this->assertSame( $meta, $colors );
if ( 0 === $i % 2 ) {
wp_cache_delete( $post_id, 'post_meta' );
@@ -399,7 +399,7 @@ class Tests_Meta extends WP_UnitTestCase {
add_metadata( 'user', $this->author->ID, 'foo', $data );
$found = get_metadata( 'user', $this->author->ID );
- $this->assertEquals( array( $value ), $found['foo'] );
+ $this->assertSame( array( $value ), $found['foo'] );
}
/**
diff --git a/tests/phpunit/tests/meta/deleteMetadata.php b/tests/phpunit/tests/meta/deleteMetadata.php
index 024ac5b526..a769d00559 100644
--- a/tests/phpunit/tests/meta/deleteMetadata.php
+++ b/tests/phpunit/tests/meta/deleteMetadata.php
@@ -156,7 +156,7 @@ class Tests_Meta_DeleteMetadata extends WP_UnitTestCase {
}
public function action_check_object_id_is_int( $meta_type, $object_id ) {
- $this->assertEquals(
+ $this->assertSame(
'integer',
gettype( $object_id )
);
diff --git a/tests/phpunit/tests/meta/query.php b/tests/phpunit/tests/meta/query.php
index 417c59646f..b082ba72e2 100644
--- a/tests/phpunit/tests/meta/query.php
+++ b/tests/phpunit/tests/meta/query.php
@@ -10,12 +10,12 @@ class Tests_Meta_Query extends WP_UnitTestCase {
public function test_empty_meta_query_param() {
$query = new WP_Meta_Query();
- $this->assertSame( null, $query->relation );
+ $this->assertNull( $query->relation );
}
public function test_default_relation() {
$query = new WP_Meta_Query( array( array( 'key' => 'abc' ) ) );
- $this->assertEquals( 'AND', $query->relation );
+ $this->assertSame( 'AND', $query->relation );
}
public function test_set_relation() {
@@ -27,7 +27,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
)
);
- $this->assertEquals( 'AND', $query->relation );
+ $this->assertSame( 'AND', $query->relation );
$query = new WP_Meta_Query(
array(
@@ -36,7 +36,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
)
);
- $this->assertEquals( 'OR', $query->relation );
+ $this->assertSame( 'OR', $query->relation );
}
/**
@@ -74,7 +74,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
$sql = $query->get_sql( 'post', $wpdb->posts, 'ID' );
- $this->assertEquals( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
+ $this->assertSame( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
// Also check mixing key and key => value.
@@ -92,7 +92,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
$sql = $query->get_sql( 'post', $wpdb->posts, 'ID' );
- $this->assertEquals( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
+ $this->assertSame( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
}
/**
@@ -120,17 +120,17 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'compare' => 'bar',
'value' => 'baz',
);
- $this->assertEquals( $expected0, $query->queries[0] );
+ $this->assertSame( $expected0, $query->queries[0] );
$expected1 = array(
- 'relation' => 'OR',
array(
'key' => 'foo1',
'compare' => 'baz1',
'value' => 'bar1',
),
+ 'relation' => 'OR',
);
- $this->assertEquals( $expected1, $query->queries[1] );
+ $this->assertSame( $expected1, $query->queries[1] );
}
/**
@@ -176,25 +176,25 @@ class Tests_Meta_Query extends WP_UnitTestCase {
// Just meta_value.
$expected = array(
- 'relation' => 'OR',
array(
'key' => 'abc',
),
+ 'relation' => 'OR',
);
$query->parse_query_vars(
array(
'meta_key' => 'abc',
)
);
- $this->assertEquals( $expected, $query->queries );
+ $this->assertSame( $expected, $query->queries );
// meta_key & meta_value.
$expected = array(
- 'relation' => 'OR',
array(
'key' => 'abc',
'value' => 'def',
),
+ 'relation' => 'OR',
);
$query->parse_query_vars(
array(
@@ -202,15 +202,15 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'meta_value' => 'def',
)
);
- $this->assertEquals( $expected, $query->queries );
+ $this->assertSame( $expected, $query->queries );
// meta_compare.
$expected = array(
- 'relation' => 'OR',
array(
'key' => 'abc',
'compare' => '=>',
),
+ 'relation' => 'OR',
);
$query->parse_query_vars(
array(
@@ -218,7 +218,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'meta_compare' => '=>',
)
);
- $this->assertEquals( $expected, $query->queries );
+ $this->assertSame( $expected, $query->queries );
}
/**
@@ -226,42 +226,42 @@ class Tests_Meta_Query extends WP_UnitTestCase {
*/
public function test_get_cast_for_type() {
$query = new WP_Meta_Query();
- $this->assertEquals( 'BINARY', $query->get_cast_for_type( 'BINARY' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'CHAR' ) );
- $this->assertEquals( 'DATE', $query->get_cast_for_type( 'DATE' ) );
- $this->assertEquals( 'DATETIME', $query->get_cast_for_type( 'DATETIME' ) );
- $this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'SIGNED' ) );
- $this->assertEquals( 'UNSIGNED', $query->get_cast_for_type( 'UNSIGNED' ) );
- $this->assertEquals( 'TIME', $query->get_cast_for_type( 'TIME' ) );
- $this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'NUMERIC' ) );
- $this->assertEquals( 'NUMERIC(10)', $query->get_cast_for_type( 'NUMERIC(10)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10 )' ) );
- $this->assertEquals( 'NUMERIC(10, 5)', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) );
- $this->assertEquals( 'NUMERIC(10,5)', $query->get_cast_for_type( 'NUMERIC(10,5)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10, 5 )' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5 )' ) );
- $this->assertEquals( 'DECIMAL', $query->get_cast_for_type( 'DECIMAL' ) );
- $this->assertEquals( 'DECIMAL(10)', $query->get_cast_for_type( 'DECIMAL(10)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10 )' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10 )' ) );
- $this->assertEquals( 'DECIMAL(10, 5)', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) );
- $this->assertEquals( 'DECIMAL(10,5)', $query->get_cast_for_type( 'DECIMAL(10,5)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) );
+ $this->assertSame( 'BINARY', $query->get_cast_for_type( 'BINARY' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'CHAR' ) );
+ $this->assertSame( 'DATE', $query->get_cast_for_type( 'DATE' ) );
+ $this->assertSame( 'DATETIME', $query->get_cast_for_type( 'DATETIME' ) );
+ $this->assertSame( 'SIGNED', $query->get_cast_for_type( 'SIGNED' ) );
+ $this->assertSame( 'UNSIGNED', $query->get_cast_for_type( 'UNSIGNED' ) );
+ $this->assertSame( 'TIME', $query->get_cast_for_type( 'TIME' ) );
+ $this->assertSame( 'SIGNED', $query->get_cast_for_type( 'NUMERIC' ) );
+ $this->assertSame( 'NUMERIC(10)', $query->get_cast_for_type( 'NUMERIC(10)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10 )' ) );
+ $this->assertSame( 'NUMERIC(10, 5)', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) );
+ $this->assertSame( 'NUMERIC(10,5)', $query->get_cast_for_type( 'NUMERIC(10,5)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10, 5 )' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5 )' ) );
+ $this->assertSame( 'DECIMAL', $query->get_cast_for_type( 'DECIMAL' ) );
+ $this->assertSame( 'DECIMAL(10)', $query->get_cast_for_type( 'DECIMAL(10)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10 )' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10 )' ) );
+ $this->assertSame( 'DECIMAL(10, 5)', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) );
+ $this->assertSame( 'DECIMAL(10,5)', $query->get_cast_for_type( 'DECIMAL(10,5)' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type() );
- $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type() );
+ $this->assertSame( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) );
}
public function test_sanitize_query_single_query() {
$expected = array(
- 'relation' => 'OR',
array(
'key' => 'foo',
'value' => 'bar',
),
+ 'relation' => 'OR',
);
$q = new WP_Meta_Query();
@@ -274,12 +274,11 @@ class Tests_Meta_Query extends WP_UnitTestCase {
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_sanitize_query_multiple_first_order_queries_relation_default() {
$expected = array(
- 'relation' => 'AND',
array(
'key' => 'foo',
'value' => 'bar',
@@ -288,6 +287,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'AND',
);
$q = new WP_Meta_Query();
@@ -304,12 +304,11 @@ class Tests_Meta_Query extends WP_UnitTestCase {
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_sanitize_query_multiple_first_order_queries_relation_or() {
$expected = array(
- 'relation' => 'OR',
array(
'key' => 'foo',
'value' => 'bar',
@@ -318,12 +317,12 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'OR',
);
$q = new WP_Meta_Query();
$found = $q->sanitize_query(
array(
- 'relation' => 'OR',
array(
'key' => 'foo',
'value' => 'bar',
@@ -332,15 +331,15 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'OR',
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_sanitize_query_multiple_first_order_queries_relation_or_lowercase() {
$expected = array(
- 'relation' => 'OR',
array(
'key' => 'foo',
'value' => 'bar',
@@ -349,12 +348,12 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'OR',
);
$q = new WP_Meta_Query();
$found = $q->sanitize_query(
array(
- 'relation' => 'or',
array(
'key' => 'foo',
'value' => 'bar',
@@ -363,15 +362,15 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'or',
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_sanitize_query_multiple_first_order_queries_invalid_relation() {
$expected = array(
- 'relation' => 'AND',
array(
'key' => 'foo',
'value' => 'bar',
@@ -380,12 +379,12 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'AND',
);
$q = new WP_Meta_Query();
$found = $q->sanitize_query(
array(
- 'relation' => 'FOO',
array(
'key' => 'foo',
'value' => 'bar',
@@ -394,17 +393,16 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'FOO',
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_sanitize_query_single_query_which_is_a_nested_query() {
$expected = array(
- 'relation' => 'OR',
array(
- 'relation' => 'AND',
array(
'key' => 'foo',
'value' => 'bar',
@@ -413,7 +411,9 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'AND',
),
+ 'relation' => 'OR',
);
$q = new WP_Meta_Query();
@@ -432,14 +432,12 @@ class Tests_Meta_Query extends WP_UnitTestCase {
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_sanitize_query_multiple_nested_queries() {
$expected = array(
- 'relation' => 'OR',
array(
- 'relation' => 'AND',
array(
'key' => 'foo',
'value' => 'bar',
@@ -448,9 +446,9 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo2',
'value' => 'bar2',
),
+ 'relation' => 'AND',
),
array(
- 'relation' => 'AND',
array(
'key' => 'foo3',
'value' => 'bar3',
@@ -459,13 +457,14 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'foo4',
'value' => 'bar4',
),
+ 'relation' => 'AND',
),
+ 'relation' => 'OR',
);
$q = new WP_Meta_Query();
$found = $q->sanitize_query(
array(
- 'relation' => 'OR',
array(
array(
'key' => 'foo',
@@ -486,10 +485,11 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'value' => 'bar4',
),
),
+ 'relation' => 'OR',
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
/**
@@ -528,7 +528,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
- $this->assertEquals( 3, substr_count( $sql['join'], 'JOIN' ) );
+ $this->assertSame( 3, substr_count( $sql['join'], 'JOIN' ) );
}
/**
@@ -548,7 +548,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
);
$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
- $this->assertEquals( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_value = ''" ) );
+ $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_value = ''" ) );
}
/**
@@ -560,8 +560,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
$query1 = new WP_Meta_Query(
array(
- 'relation' => 'OR',
-
// Empty 'compare'.
array(
'key' => 'foo',
@@ -589,6 +587,8 @@ class Tests_Meta_Query extends WP_UnitTestCase {
array(
'value' => 'bar',
),
+
+ 'relation' => 'OR',
)
);
@@ -604,8 +604,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
// 'AND' queries don't have key-only queries.
$query2 = new WP_Meta_Query(
array(
- 'relation' => 'AND',
-
// Empty 'compare'.
array(
'key' => 'foo',
@@ -616,6 +614,8 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'key' => 'bar',
'compare' => '<',
),
+
+ 'relation' => 'AND',
)
);
@@ -887,7 +887,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
$query = new WP_Meta_Query(
array(
- 'relation' => 'OR',
array(
'key' => 'exclude',
'compare' => 'NOT EXISTS',
@@ -897,6 +896,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'compare' => '!=',
'value' => '1',
),
+ 'relation' => 'OR',
)
);
@@ -910,7 +910,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
$query = new WP_Meta_Query(
array(
- 'relation' => 'OR',
array(
'key' => 'exclude',
'compare' => '',
@@ -920,6 +919,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'compare' => '!=',
'value' => '1',
),
+ 'relation' => 'OR',
)
);
@@ -936,7 +936,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
public function test_has_or_relation_should_return_false() {
$q = new WP_Meta_Query(
array(
- 'relation' => 'AND',
array(
'key' => 'foo',
'value' => 'bar',
@@ -952,6 +951,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'value' => 'bar',
),
),
+ 'relation' => 'AND',
)
);
@@ -964,7 +964,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
public function test_has_or_relation_should_return_true_for_top_level_or() {
$q = new WP_Meta_Query(
array(
- 'relation' => 'OR',
array(
'key' => 'foo',
'value' => 'bar',
@@ -980,6 +979,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'value' => 'bar',
),
),
+ 'relation' => 'OR',
)
);
@@ -992,7 +992,6 @@ class Tests_Meta_Query extends WP_UnitTestCase {
public function test_has_or_relation_should_return_true_for_nested_or() {
$q = new WP_Meta_Query(
array(
- 'relation' => 'AND',
array(
'key' => 'foo',
'value' => 'bar',
@@ -1008,6 +1007,7 @@ class Tests_Meta_Query extends WP_UnitTestCase {
'value' => 'bar',
),
),
+ 'relation' => 'AND',
)
);
diff --git a/tests/phpunit/tests/meta/registerMeta.php b/tests/phpunit/tests/meta/registerMeta.php
index 025a2a1e71..22c282c437 100644
--- a/tests/phpunit/tests/meta/registerMeta.php
+++ b/tests/phpunit/tests/meta/registerMeta.php
@@ -45,7 +45,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
remove_filter( 'auth_post_meta_flight_number', array( $this, '_old_auth_meta_cb' ) );
// The filter should have been added with a priority of 10.
- $this->assertEquals( 10, $has_filter );
+ $this->assertSame( 10, $has_filter );
}
public function test_register_meta_back_compat_with_sanitize_callback_and_no_auth_callback_has_old_style_sanitize_filter() {
@@ -53,7 +53,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
$has_filter = has_filter( 'sanitize_post_meta_flight_number', array( $this, '_old_sanitize_meta_cb' ) );
remove_filter( 'sanitize_post_meta_flight_number', array( $this, '_old_sanitize_meta_cb' ) );
- $this->assertEquals( 10, $has_filter );
+ $this->assertSame( 10, $has_filter );
}
public function test_register_meta_back_compat_with_auth_and_sanitize_callback_has_old_style_filters() {
@@ -64,7 +64,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
remove_filter( 'auth_post_meta_flight_number', array( $this, '_old_auth_meta_cb' ) );
remove_filter( 'sanitize_post_meta_flight_number', array( $this, '_old_sanitize_meta_cb' ) );
- $this->assertEquals(
+ $this->assertSame(
array(
'auth' => 10,
'sanitize' => 10,
@@ -102,7 +102,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
),
);
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
public function test_register_meta_with_term_object_type_populates_wp_meta_keys() {
@@ -126,7 +126,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
),
);
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
public function test_register_meta_with_deprecated_sanitize_callback_does_not_populate_wp_meta_keys() {
@@ -137,7 +137,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
remove_filter( 'sanitize_post_meta_flight_number', array( $this, '_old_sanitize_meta_cb' ) );
remove_filter( 'auth_post_meta_flight_number', '__return_true' );
- $this->assertEquals( array(), $actual );
+ $this->assertSame( array(), $actual );
}
public function test_register_meta_with_deprecated_sanitize_callback_param_returns_false() {
@@ -156,7 +156,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
remove_filter( 'sanitize_post_meta_flight_number', array( $this, '_old_sanitize_meta_cb' ) );
remove_filter( 'auth_post_meta_flight_number', '__return_true' );
- $this->assertEquals( 'old_sanitized_key old sanitized', $meta );
+ $this->assertSame( 'old_sanitized_key old sanitized', $meta );
}
public function test_register_meta_with_current_sanitize_callback_populates_wp_meta_keys() {
@@ -179,7 +179,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
),
),
);
- $this->assertEquals( $actual, $expected );
+ $this->assertSame( $actual, $expected );
}
public function test_register_meta_with_current_sanitize_callback_returns_true() {
@@ -195,7 +195,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
unregister_meta_key( 'post', 'new_sanitized_key' );
- $this->assertEquals( 'new_sanitized_key new sanitized', $meta );
+ $this->assertSame( 'new_sanitized_key new sanitized', $meta );
}
public function test_register_meta_unregistered_meta_key_removes_sanitize_filter() {
@@ -221,7 +221,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
register_meta( 'post', 'registered_key', array() );
unregister_meta_key( 'post', 'registered_key' );
- $this->assertEquals( array(), $wp_meta_keys );
+ $this->assertSame( array(), $wp_meta_keys );
}
public function test_unregister_meta_key_with_invalid_key_returns_false() {
@@ -260,7 +260,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
unregister_meta_key( 'post', 'registered_key1' );
- $this->assertEquals( 'I\'m just a field, take a good look at me', $meta_keys['registered_key1']['description'] );
+ $this->assertSame( 'I\'m just a field, take a good look at me', $meta_keys['registered_key1']['description'] );
}
public function test_get_registered_meta_keys_invalid_arg() {
@@ -281,7 +281,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
unregister_meta_key( 'post', 'flight_number' );
- $this->assertEquals( 'Oceanic 815', $meta['flight_number'][0] );
+ $this->assertSame( 'Oceanic 815', $meta['flight_number'][0] );
}
public function test_get_registered_metadata_by_key() {
@@ -292,7 +292,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
unregister_meta_key( 'post', 'flight_number' );
- $this->assertEquals( 'Oceanic 815', $meta[0] );
+ $this->assertSame( 'Oceanic 815', $meta[0] );
}
public function test_get_registered_metadata_by_key_single() {
@@ -303,7 +303,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
unregister_meta_key( 'post', 'flight_number' );
- $this->assertEquals( 'Oceanic 815', $meta );
+ $this->assertSame( 'Oceanic 815', $meta );
}
public function test_get_registered_metadata_by_invalid_key() {
@@ -352,7 +352,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
// Reset global so subsequent data tests do not get polluted.
$wp_meta_keys = array();
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
/**
@@ -405,7 +405,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
// Reset global so subsequent data tests do not get polluted.
$wp_meta_keys = array();
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
/**
diff --git a/tests/phpunit/tests/meta/slashes.php b/tests/phpunit/tests/meta/slashes.php
index d8ec881134..469b04765e 100644
--- a/tests/phpunit/tests/meta/slashes.php
+++ b/tests/phpunit/tests/meta/slashes.php
@@ -71,10 +71,10 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
edit_post();
$post = get_post( $id );
- $this->assertEquals( $this->slash_6, get_post_meta( $id, 'slash_test_0', true ) );
- $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( $this->slash_6, get_post_meta( $id, 'slash_test_0', true ) );
+ $this->assertSame( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
$_POST = array();
$_POST['post_ID'] = $id;
@@ -101,9 +101,9 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
edit_post();
$post = get_post( $id );
- $this->assertEquals( $this->slash_2, get_post_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( $this->slash_5, get_post_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( $this->slash_2, get_post_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( $this->slash_4, get_post_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( $this->slash_5, get_post_meta( $id, 'slash_test_3', true ) );
}
/**
@@ -115,9 +115,9 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
add_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
add_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) );
- $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
}
/**
@@ -129,9 +129,9 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
update_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
update_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) );
- $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
}
/**
@@ -144,17 +144,17 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
add_comment_meta( $id, 'slash_test_2', $this->slash_3 );
add_comment_meta( $id, 'slash_test_3', $this->slash_5 );
- $this->assertEquals( wp_unslash( $this->slash_1 ), get_comment_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( wp_unslash( $this->slash_3 ), get_comment_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( wp_unslash( $this->slash_5 ), get_comment_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( wp_unslash( $this->slash_1 ), get_comment_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( wp_unslash( $this->slash_3 ), get_comment_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( wp_unslash( $this->slash_5 ), get_comment_meta( $id, 'slash_test_3', true ) );
add_comment_meta( $id, 'slash_test_4', $this->slash_2 );
add_comment_meta( $id, 'slash_test_5', $this->slash_4 );
add_comment_meta( $id, 'slash_test_6', $this->slash_6 );
- $this->assertEquals( wp_unslash( $this->slash_2 ), get_comment_meta( $id, 'slash_test_4', true ) );
- $this->assertEquals( wp_unslash( $this->slash_4 ), get_comment_meta( $id, 'slash_test_5', true ) );
- $this->assertEquals( wp_unslash( $this->slash_6 ), get_comment_meta( $id, 'slash_test_6', true ) );
+ $this->assertSame( wp_unslash( $this->slash_2 ), get_comment_meta( $id, 'slash_test_4', true ) );
+ $this->assertSame( wp_unslash( $this->slash_4 ), get_comment_meta( $id, 'slash_test_5', true ) );
+ $this->assertSame( wp_unslash( $this->slash_6 ), get_comment_meta( $id, 'slash_test_6', true ) );
}
/**
@@ -171,17 +171,17 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
update_comment_meta( $id, 'slash_test_2', $this->slash_3 );
update_comment_meta( $id, 'slash_test_3', $this->slash_5 );
- $this->assertEquals( wp_unslash( $this->slash_1 ), get_comment_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( wp_unslash( $this->slash_3 ), get_comment_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( wp_unslash( $this->slash_5 ), get_comment_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( wp_unslash( $this->slash_1 ), get_comment_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( wp_unslash( $this->slash_3 ), get_comment_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( wp_unslash( $this->slash_5 ), get_comment_meta( $id, 'slash_test_3', true ) );
update_comment_meta( $id, 'slash_test_1', $this->slash_2 );
update_comment_meta( $id, 'slash_test_2', $this->slash_4 );
update_comment_meta( $id, 'slash_test_3', $this->slash_6 );
- $this->assertEquals( wp_unslash( $this->slash_2 ), get_comment_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( wp_unslash( $this->slash_4 ), get_comment_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( wp_unslash( $this->slash_6 ), get_comment_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( wp_unslash( $this->slash_2 ), get_comment_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( wp_unslash( $this->slash_4 ), get_comment_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( wp_unslash( $this->slash_6 ), get_comment_meta( $id, 'slash_test_3', true ) );
}
/**
@@ -194,17 +194,17 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
add_user_meta( $id, 'slash_test_2', $this->slash_3 );
add_user_meta( $id, 'slash_test_3', $this->slash_5 );
- $this->assertEquals( wp_unslash( $this->slash_1 ), get_user_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( wp_unslash( $this->slash_3 ), get_user_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( wp_unslash( $this->slash_5 ), get_user_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( wp_unslash( $this->slash_1 ), get_user_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( wp_unslash( $this->slash_3 ), get_user_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( wp_unslash( $this->slash_5 ), get_user_meta( $id, 'slash_test_3', true ) );
add_user_meta( $id, 'slash_test_4', $this->slash_2 );
add_user_meta( $id, 'slash_test_5', $this->slash_4 );
add_user_meta( $id, 'slash_test_6', $this->slash_6 );
- $this->assertEquals( wp_unslash( $this->slash_2 ), get_user_meta( $id, 'slash_test_4', true ) );
- $this->assertEquals( wp_unslash( $this->slash_4 ), get_user_meta( $id, 'slash_test_5', true ) );
- $this->assertEquals( wp_unslash( $this->slash_6 ), get_user_meta( $id, 'slash_test_6', true ) );
+ $this->assertSame( wp_unslash( $this->slash_2 ), get_user_meta( $id, 'slash_test_4', true ) );
+ $this->assertSame( wp_unslash( $this->slash_4 ), get_user_meta( $id, 'slash_test_5', true ) );
+ $this->assertSame( wp_unslash( $this->slash_6 ), get_user_meta( $id, 'slash_test_6', true ) );
}
/**
@@ -221,16 +221,16 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
update_user_meta( $id, 'slash_test_2', $this->slash_3 );
update_user_meta( $id, 'slash_test_3', $this->slash_5 );
- $this->assertEquals( wp_unslash( $this->slash_1 ), get_user_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( wp_unslash( $this->slash_3 ), get_user_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( wp_unslash( $this->slash_5 ), get_user_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( wp_unslash( $this->slash_1 ), get_user_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( wp_unslash( $this->slash_3 ), get_user_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( wp_unslash( $this->slash_5 ), get_user_meta( $id, 'slash_test_3', true ) );
update_user_meta( $id, 'slash_test_1', $this->slash_2 );
update_user_meta( $id, 'slash_test_2', $this->slash_4 );
update_user_meta( $id, 'slash_test_3', $this->slash_6 );
- $this->assertEquals( wp_unslash( $this->slash_2 ), get_user_meta( $id, 'slash_test_1', true ) );
- $this->assertEquals( wp_unslash( $this->slash_4 ), get_user_meta( $id, 'slash_test_2', true ) );
- $this->assertEquals( wp_unslash( $this->slash_6 ), get_user_meta( $id, 'slash_test_3', true ) );
+ $this->assertSame( wp_unslash( $this->slash_2 ), get_user_meta( $id, 'slash_test_1', true ) );
+ $this->assertSame( wp_unslash( $this->slash_4 ), get_user_meta( $id, 'slash_test_2', true ) );
+ $this->assertSame( wp_unslash( $this->slash_6 ), get_user_meta( $id, 'slash_test_3', true ) );
}
}
diff --git a/tests/phpunit/tests/multisite.php b/tests/phpunit/tests/multisite.php
index e4150a2b0e..e96f3d27ce 100644
--- a/tests/phpunit/tests/multisite.php
+++ b/tests/phpunit/tests/multisite.php
@@ -32,7 +32,7 @@ if ( is_multisite() ) :
// Currently there is no wrapper function for the registration_log.
$reg_blog = $wpdb->get_col( $wpdb->prepare( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE %s", $ip ) );
- $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] );
+ $this->assertSame( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] );
}
/**
@@ -88,7 +88,7 @@ if ( is_multisite() ) :
$expected['all'] += 1;
$expected['public'] += 1;
- $this->assertEquals( $expected, $counts );
+ $this->assertSame( $expected, $counts );
}
}
diff --git a/tests/phpunit/tests/multisite/bootstrap.php b/tests/phpunit/tests/multisite/bootstrap.php
index 9b85114624..eabf78297b 100644
--- a/tests/phpunit/tests/multisite/bootstrap.php
+++ b/tests/phpunit/tests/multisite/bootstrap.php
@@ -125,7 +125,7 @@ if ( is_multisite() ) :
*/
function test_get_network_by_path( $expected_key, $domain, $path, $message ) {
$network = get_network_by_path( $domain, $path );
- $this->assertEquals( self::$network_ids[ $expected_key ], $network->id, $message );
+ $this->assertSame( self::$network_ids[ $expected_key ], $network->id, $message );
}
public function data_get_network_by_path() {
@@ -161,7 +161,7 @@ if ( is_multisite() ) :
remove_filter( 'network_by_path_segments_count', '__return_zero' );
- $this->assertEquals( self::$network_ids[ $expected_key ], $network->id, $message );
+ $this->assertSame( self::$network_ids[ $expected_key ], $network->id, $message );
}
public function data_get_network_by_path_with_zero_path_segments() {
@@ -186,7 +186,7 @@ if ( is_multisite() ) :
$network = get_network_by_path( 'wordpress.org', '/one/b/' );
remove_filter( 'network_by_path_segments_count', array( $this, 'filter_network_path_segments' ) );
- $this->assertEquals( self::$network_ids['wordpress.org/one/'], $network->id );
+ $this->assertSame( self::$network_ids['wordpress.org/one/'], $network->id );
}
public function filter_network_path_segments() {
diff --git a/tests/phpunit/tests/multisite/getBlogDetails.php b/tests/phpunit/tests/multisite/getBlogDetails.php
index 51d980465c..f79b065725 100644
--- a/tests/phpunit/tests/multisite/getBlogDetails.php
+++ b/tests/phpunit/tests/multisite/getBlogDetails.php
@@ -125,7 +125,7 @@ if ( is_multisite() ) :
}
$site = get_blog_details( array( 'domain' => 'wordpress.org' ) );
- $this->assertEquals( self::$site_ids['wordpress.org/'], $site->blog_id );
+ $this->assertSame( self::$site_ids['wordpress.org/'], $site->blog_id );
}
public function test_get_blog_details_with_only_domain_in_fields_subdirectory() {
diff --git a/tests/phpunit/tests/multisite/getIdFromBlogname.php b/tests/phpunit/tests/multisite/getIdFromBlogname.php
index 1e50110018..3df68afe86 100644
--- a/tests/phpunit/tests/multisite/getIdFromBlogname.php
+++ b/tests/phpunit/tests/multisite/getIdFromBlogname.php
@@ -101,7 +101,7 @@ if ( is_multisite() ) :
$result = get_id_from_blogname( 'foo' );
$current_site = $original_network;
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
/**
@@ -122,7 +122,7 @@ if ( is_multisite() ) :
$result = get_id_from_blogname( 'foo' );
$current_site = $original_network;
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
public function test_get_id_from_blogname_invalid_slug() {
@@ -134,7 +134,7 @@ if ( is_multisite() ) :
$result = get_id_from_blogname( 'bar' );
$current_site = $original_network;
- $this->assertEquals( null, $result );
+ $this->assertNull( $result );
}
}
diff --git a/tests/phpunit/tests/multisite/getSite.php b/tests/phpunit/tests/multisite/getSite.php
index aeaa9ddf2e..1df45df9be 100644
--- a/tests/phpunit/tests/multisite/getSite.php
+++ b/tests/phpunit/tests/multisite/getSite.php
@@ -45,7 +45,7 @@ if ( is_multisite() ) :
$site = get_site();
restore_current_blog();
- $this->assertEquals( self::$site_ids['wordpress.org/foo/'], $site->id );
+ $this->assertSame( self::$site_ids['wordpress.org/foo/'], $site->id );
}
}
diff --git a/tests/phpunit/tests/multisite/getSpaceAllowed.php b/tests/phpunit/tests/multisite/getSpaceAllowed.php
index e876658ba0..b534d391be 100644
--- a/tests/phpunit/tests/multisite/getSpaceAllowed.php
+++ b/tests/phpunit/tests/multisite/getSpaceAllowed.php
@@ -48,7 +48,7 @@ if ( is_multisite() ) :
delete_option( 'blog_upload_space' );
delete_site_option( 'blog_upload_space' );
- $this->assertEquals( 100, get_space_allowed() );
+ $this->assertSame( 100, get_space_allowed() );
}
/**
@@ -59,7 +59,7 @@ if ( is_multisite() ) :
delete_site_option( 'blog_upload_space' );
update_site_option( 'blog_upload_space', 200 );
- $this->assertEquals( 200, get_space_allowed() );
+ $this->assertSame( 200, get_space_allowed() );
}
/**
@@ -73,7 +73,7 @@ if ( is_multisite() ) :
update_option( 'blog_upload_space', $site_option );
update_site_option( 'blog_upload_space', $network_option );
- $this->assertEquals( $expected, get_space_allowed() );
+ $this->assertSame( $expected, get_space_allowed() );
}
public function data_blog_upload_space() {
@@ -108,7 +108,7 @@ if ( is_multisite() ) :
$space_allowed = get_space_allowed();
remove_filter( 'get_space_allowed', array( $this, '_filter_space_allowed' ) );
- $this->assertEquals( 999, $space_allowed );
+ $this->assertSame( 999, $space_allowed );
}
public function _filter_space_allowed() {
diff --git a/tests/phpunit/tests/multisite/getSpaceUsed.php b/tests/phpunit/tests/multisite/getSpaceUsed.php
index 7d6d33304c..f3a4c93ecc 100644
--- a/tests/phpunit/tests/multisite/getSpaceUsed.php
+++ b/tests/phpunit/tests/multisite/getSpaceUsed.php
@@ -44,7 +44,7 @@ if ( is_multisite() ) :
delete_transient( 'dirsize_cache' );
- $this->assertEquals( $size, get_space_used() );
+ $this->assertSame( $size, get_space_used() );
$upload_dir = wp_upload_dir();
$this->remove_added_uploads();
$this->delete_folders( $upload_dir['basedir'] );
@@ -79,7 +79,7 @@ if ( is_multisite() ) :
delete_transient( 'dirsize_cache' );
- $this->assertEquals( $space_used, get_space_used() );
+ $this->assertSame( $space_used, get_space_used() );
// Switch back to the new site to remove the uploaded file.
switch_to_blog( $blog_id );
@@ -92,7 +92,7 @@ if ( is_multisite() ) :
function test_get_space_used_pre_get_spaced_used_filter() {
add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
- $this->assertEquals( 300, get_space_used() );
+ $this->assertSame( 300, get_space_used() );
remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
}
diff --git a/tests/phpunit/tests/multisite/ms-files-rewriting.php b/tests/phpunit/tests/multisite/ms-files-rewriting.php
index 1d39234397..c7a8e7b8e3 100644
--- a/tests/phpunit/tests/multisite/ms-files-rewriting.php
+++ b/tests/phpunit/tests/multisite/ms-files-rewriting.php
@@ -40,18 +40,18 @@ if ( is_multisite() ) :
$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
$blog_id2 = self::factory()->blog->create( array( 'user_id' => $user_id ) );
$info = wp_upload_dir();
- $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );
- $this->assertEquals( gmstrftime( '/%Y/%m' ), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
+ $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );
+ $this->assertSame( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );
+ $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );
+ $this->assertFalse( $info['error'] );
switch_to_blog( $blog_id2 );
$info2 = wp_upload_dir();
$this->assertNotEquals( $info, $info2 );
- $this->assertEquals( get_option( 'siteurl' ) . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime( '%Y/%m' ), $info2['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime( '%Y/%m' ), $info2['path'] );
- $this->assertEquals( gmstrftime( '/%Y/%m' ), $info2['subdir'] );
- $this->assertEquals( '', $info2['error'] );
+ $this->assertSame( get_option( 'siteurl' ) . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime( '%Y/%m' ), $info2['url'] );
+ $this->assertSame( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime( '%Y/%m' ), $info2['path'] );
+ $this->assertSame( gmstrftime( '/%Y/%m' ), $info2['subdir'] );
+ $this->assertFalse( $info2['error'] );
restore_current_blog();
}
diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php
index bfe220638b..ff7a2ff4b5 100644
--- a/tests/phpunit/tests/multisite/network.php
+++ b/tests/phpunit/tests/multisite/network.php
@@ -76,7 +76,7 @@ if ( is_multisite() ) :
* By default, only one network exists and has a network ID of 1.
*/
function test_get_main_network_id_default() {
- $this->assertEquals( 1, get_main_network_id() );
+ $this->assertSame( 1, get_main_network_id() );
}
/**
@@ -86,7 +86,7 @@ if ( is_multisite() ) :
function test_get_main_network_id_two_networks() {
self::factory()->network->create();
- $this->assertEquals( 1, get_main_network_id() );
+ $this->assertSame( 1, get_main_network_id() );
}
/**
@@ -100,7 +100,7 @@ if ( is_multisite() ) :
$current_site->id = (int) $id;
- $this->assertEquals( 1, get_main_network_id() );
+ $this->assertSame( 1, get_main_network_id() );
}
/**
@@ -120,12 +120,12 @@ if ( is_multisite() ) :
$main_network_id = get_main_network_id();
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=1 WHERE id=%d", $temp_id ) );
- $this->assertEquals( self::$different_network_id, $main_network_id );
+ $this->assertSame( self::$different_network_id, $main_network_id );
}
function test_get_main_network_id_filtered() {
add_filter( 'get_main_network_id', array( $this, '_get_main_network_id' ) );
- $this->assertEquals( 3, get_main_network_id() );
+ $this->assertSame( 3, get_main_network_id() );
remove_filter( 'get_main_network_id', array( $this, '_get_main_network_id' ) );
}
@@ -159,7 +159,7 @@ if ( is_multisite() ) :
}
wp_update_network_counts();
- $this->assertEquals( $site_count_start + 1, $actual );
+ $this->assertSame( $site_count_start + 1, $actual );
}
/**
@@ -246,7 +246,7 @@ if ( is_multisite() ) :
// No change, cache not refreshed.
$count = get_user_count();
- $this->assertEquals( $start_count, $count );
+ $this->assertSame( $start_count, $count );
wp_update_network_counts();
$start_count = get_user_count();
@@ -268,26 +268,26 @@ if ( is_multisite() ) :
// Local activate, should be invisible for the network.
activate_plugin( $path ); // Enable the plugin for the current site.
$active_plugins = wp_get_active_network_plugins();
- $this->assertEquals( array(), $active_plugins );
+ $this->assertSame( array(), $active_plugins );
add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) );
// Activate the plugin sitewide.
activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network.
$active_plugins = wp_get_active_network_plugins();
- $this->assertEquals( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins );
+ $this->assertSame( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins );
// Deactivate the plugin.
deactivate_plugins( $path );
$active_plugins = wp_get_active_network_plugins();
- $this->assertEquals( array(), $active_plugins );
+ $this->assertSame( array(), $active_plugins );
- $this->assertEquals( 1, $this->plugin_hook_count ); // Testing actions and silent mode.
+ $this->assertSame( 1, $this->plugin_hook_count ); // Testing actions and silent mode.
activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network.
deactivate_plugins( $path, true ); // Silent mode.
- $this->assertEquals( 1, $this->plugin_hook_count ); // Testing actions and silent mode.
+ $this->assertSame( 1, $this->plugin_hook_count ); // Testing actions and silent mode.
}
/**
@@ -302,13 +302,13 @@ if ( is_multisite() ) :
activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network.
$active_plugins = wp_get_active_network_plugins();
$this->assertCount( 1, $active_plugins );
- $this->assertEquals( 1, $mock->get_call_count() );
+ $this->assertSame( 1, $mock->get_call_count() );
// Should do nothing on the second try.
activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network.
$active_plugins = wp_get_active_network_plugins();
$this->assertCount( 1, $active_plugins );
- $this->assertEquals( 1, $mock->get_call_count() );
+ $this->assertSame( 1, $mock->get_call_count() );
remove_action( 'activate_' . $path, array( $mock, 'action' ) );
}
@@ -337,7 +337,7 @@ if ( is_multisite() ) :
self::factory()->user->create( array( 'role' => 'administrator' ) );
$count = get_user_count(); // No change, cache not refreshed.
- $this->assertEquals( $start_count, $count );
+ $this->assertSame( $start_count, $count );
wp_update_network_counts(); // Magic happens here.
@@ -392,7 +392,7 @@ if ( is_multisite() ) :
wp_update_network_site_counts();
$result = get_blog_count();
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
/**
@@ -404,7 +404,7 @@ if ( is_multisite() ) :
wp_update_network_site_counts( self::$different_network_id );
$result = get_blog_count( self::$different_network_id );
- $this->assertEquals( 3, $result );
+ $this->assertSame( 3, $result );
}
/**
@@ -420,7 +420,7 @@ if ( is_multisite() ) :
wp_update_network_user_counts();
$result = get_user_count();
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
/**
@@ -436,7 +436,7 @@ if ( is_multisite() ) :
wp_update_network_user_counts( self::$different_network_id );
$result = get_user_count( self::$different_network_id );
- $this->assertEquals( $expected, $result );
+ $this->assertSame( $expected, $result );
}
/**
@@ -596,7 +596,7 @@ if ( is_multisite() ) :
wpmu_delete_blog( $site_id, true );
- $this->assertEquals( $original_count + 1, $result );
+ $this->assertSame( $original_count + 1, $result );
}
/**
@@ -632,12 +632,12 @@ if ( is_multisite() ) :
$new_network = $this->factory()->network->create_and_get();
// Double-check we got the ID of the new network correct.
- $this->assertEquals( $new_network_id, $new_network->id );
+ $this->assertSame( $new_network_id, $new_network->id );
// Verify that if we fetch the network now, it's no longer false.
$fetched_network = get_network( $new_network_id );
$this->assertInstanceOf( 'WP_Network', $fetched_network );
- $this->assertEquals( $new_network_id, $fetched_network->id );
+ $this->assertSame( $new_network_id, $fetched_network->id );
}
/**
diff --git a/tests/phpunit/tests/multisite/networkQuery.php b/tests/phpunit/tests/multisite/networkQuery.php
index 0318998129..ae06d24161 100644
--- a/tests/phpunit/tests/multisite/networkQuery.php
+++ b/tests/phpunit/tests/multisite/networkQuery.php
@@ -70,7 +70,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( 3, count( $found ) );
+ $this->assertSame( 3, count( $found ) );
}
public function test_wp_network_query_by_network__in_with_order() {
@@ -85,7 +85,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
$found = $q->query(
array(
@@ -95,7 +95,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( array_reverse( $expected ), $found );
+ $this->assertSame( array_reverse( $expected ), $found );
}
public function test_wp_network_query_by_network__in_with_single_id() {
@@ -138,7 +138,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( 2, $found );
+ $this->assertSame( 2, $found );
}
public function test_wp_network_query_by_network__not_in_with_single_id() {
@@ -435,7 +435,7 @@ if ( is_multisite() ) :
self::$network_ids['make.wordpress.org/'],
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
/**
@@ -462,7 +462,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( $number_of_queries, $wpdb->num_queries );
+ $this->assertSame( $number_of_queries, $wpdb->num_queries );
}
/**
@@ -491,7 +491,7 @@ if ( is_multisite() ) :
'count' => true,
)
);
- $this->assertEquals( $number_of_queries, $wpdb->num_queries );
+ $this->assertSame( $number_of_queries, $wpdb->num_queries );
}
/**
@@ -520,7 +520,7 @@ if ( is_multisite() ) :
'count' => true,
)
);
- $this->assertEquals( $number_of_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $number_of_queries + 1, $wpdb->num_queries );
}
/**
@@ -546,7 +546,7 @@ if ( is_multisite() ) :
$this->assertSame( array( 555 ), $results );
// Make sure manually setting total_users doesn't get overwritten.
- $this->assertEquals( 1, $q->found_networks );
+ $this->assertSame( 1, $q->found_networks );
}
public static function filter_networks_pre_query( $networks, $query ) {
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 0e983e81b7..6cce1ac41a 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -91,44 +91,44 @@ if ( is_multisite() ) :
function test_switch_restore_blog() {
global $_wp_switched_stack, $wpdb;
- $this->assertEquals( array(), $_wp_switched_stack );
+ $this->assertSame( array(), $_wp_switched_stack );
$this->assertFalse( ms_is_switched() );
$current_blog_id = get_current_blog_id();
$this->assertInternalType( 'integer', $current_blog_id );
wp_cache_set( 'switch-test', $current_blog_id, 'switch-test' );
- $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+ $this->assertSame( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
$blog_id = self::factory()->blog->create();
$cap_key = wp_get_current_user()->cap_key;
switch_to_blog( $blog_id );
$this->assertNotEquals( $cap_key, wp_get_current_user()->cap_key );
- $this->assertEquals( array( $current_blog_id ), $_wp_switched_stack );
+ $this->assertSame( array( $current_blog_id ), $_wp_switched_stack );
$this->assertTrue( ms_is_switched() );
- $this->assertEquals( $blog_id, $wpdb->blogid );
+ $this->assertSame( $blog_id, $wpdb->blogid );
$this->assertFalse( wp_cache_get( 'switch-test', 'switch-test' ) );
wp_cache_set( 'switch-test', $blog_id, 'switch-test' );
- $this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+ $this->assertSame( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
switch_to_blog( $blog_id );
- $this->assertEquals( array( $current_blog_id, $blog_id ), $_wp_switched_stack );
+ $this->assertSame( array( $current_blog_id, $blog_id ), $_wp_switched_stack );
$this->assertTrue( ms_is_switched() );
- $this->assertEquals( $blog_id, $wpdb->blogid );
- $this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+ $this->assertSame( $blog_id, $wpdb->blogid );
+ $this->assertSame( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
restore_current_blog();
- $this->assertEquals( array( $current_blog_id ), $_wp_switched_stack );
+ $this->assertSame( array( $current_blog_id ), $_wp_switched_stack );
$this->assertTrue( ms_is_switched() );
- $this->assertEquals( $blog_id, $wpdb->blogid );
- $this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+ $this->assertSame( $blog_id, $wpdb->blogid );
+ $this->assertSame( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
restore_current_blog();
- $this->assertEquals( $cap_key, wp_get_current_user()->cap_key );
- $this->assertEquals( $current_blog_id, get_current_blog_id() );
- $this->assertEquals( array(), $_wp_switched_stack );
+ $this->assertSame( $cap_key, wp_get_current_user()->cap_key );
+ $this->assertSame( $current_blog_id, get_current_blog_id() );
+ $this->assertSame( array(), $_wp_switched_stack );
$this->assertFalse( ms_is_switched() );
- $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+ $this->assertSame( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
$this->assertFalse( restore_current_blog() );
}
@@ -153,11 +153,11 @@ if ( is_multisite() ) :
$this->assertEquals( $details, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
// get_blogaddress_by_name().
- $this->assertEquals( 'http://' . $details->domain . $details->path, get_blogaddress_by_name( trim( $details->path, '/' ) ) );
+ $this->assertSame( 'http://' . $details->domain . $details->path, get_blogaddress_by_name( trim( $details->path, '/' ) ) );
// These are empty until get_blog_details() is called with $get_all = true.
- $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
+ $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) );
// $get_all = true, populate the full blog-details cache and the blog slug lookup cache.
$details = get_blog_details( $blog_id, true );
@@ -189,7 +189,7 @@ if ( is_multisite() ) :
// Update the blog count cache to use get_blog_count().
wp_update_network_counts();
- $this->assertEquals( 2, (int) get_blog_count() );
+ $this->assertSame( 2, (int) get_blog_count() );
}
public function test_site_caches_should_invalidate_when_invalidation_is_not_suspended() {
@@ -215,7 +215,7 @@ if ( is_multisite() ) :
$new_details = get_site( $site_id );
wp_suspend_cache_invalidation( $suspend );
- $this->assertEquals( $details->path, $new_details->path );
+ $this->assertSame( $details->path, $new_details->path );
}
/**
@@ -230,10 +230,10 @@ if ( is_multisite() ) :
// Delete the site without forcing a table drop.
wpmu_delete_blog( $blog_id, false );
- $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) );
}
/**
@@ -271,10 +271,10 @@ if ( is_multisite() ) :
// Delete the site and force a table drop.
wpmu_delete_blog( $blog_id, true );
- $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) );
}
/**
@@ -312,10 +312,10 @@ if ( is_multisite() ) :
// Delete the site and force a table drop.
wpmu_delete_blog( $blog_id, true );
- $this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) );
}
/**
@@ -352,7 +352,7 @@ if ( is_multisite() ) :
// Update the blog count cache to use get_blog_count().
wp_update_network_counts();
- $this->assertEquals( 1, get_blog_count() );
+ $this->assertSame( 1, get_blog_count() );
}
/**
@@ -366,7 +366,7 @@ if ( is_multisite() ) :
// Update the blog count cache to use get_blog_count().
wp_update_network_counts();
- $this->assertEquals( 1, get_blog_count() );
+ $this->assertSame( 1, get_blog_count() );
}
/**
@@ -434,7 +434,7 @@ if ( is_multisite() ) :
get_blog_details( $blog_id );
// When the cache is primed with an invalid site, the value is set to -1.
- $this->assertEquals( -1, wp_cache_get( $blog_id, 'blog-details' ) );
+ $this->assertSame( -1, wp_cache_get( $blog_id, 'blog-details' ) );
// Create a site in the invalid site's place.
self::factory()->blog->create();
@@ -453,7 +453,7 @@ if ( is_multisite() ) :
*/
function test_update_blog_status() {
$result = update_blog_status( 1, 'spam', 0 );
- $this->assertEquals( 0, $result );
+ $this->assertSame( 0, $result );
}
/**
@@ -461,7 +461,7 @@ if ( is_multisite() ) :
*/
function test_update_blog_status_invalid_status() {
$result = update_blog_status( 1, 'doesnotexist', 'invalid' );
- $this->assertEquals( 'invalid', $result );
+ $this->assertSame( 'invalid', $result );
}
function test_update_blog_status_make_ham_blog_action() {
@@ -475,15 +475,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'spam', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->spam );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->spam );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'spam' stays the same.
update_blog_status( $blog_id, 'spam', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->spam );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->spam );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -498,15 +498,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'spam', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->spam );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->spam );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'spam' stays the same.
update_blog_status( $blog_id, 'spam', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->spam );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->spam );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -521,15 +521,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'archived', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->archived );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->archived );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'archived' stays the same.
update_blog_status( $blog_id, 'archived', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->archived );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->archived );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -545,14 +545,14 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'archived', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->archived );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->archived );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'archived' stays the same.
update_blog_status( $blog_id, 'archived', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->archived );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->archived );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -567,15 +567,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'deleted', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->deleted );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'deleted' stays the same.
update_blog_status( $blog_id, 'deleted', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->deleted );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -591,15 +591,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'deleted', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->deleted );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'deleted' stays the same.
update_blog_status( $blog_id, 'deleted', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->deleted );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -614,15 +614,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'mature', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->mature );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->mature );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'mature' stays the same.
update_blog_status( $blog_id, 'mature', 1 );
$blog = get_site( $blog_id );
- $this->assertEquals( '1', $blog->mature );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '1', $blog->mature );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -638,15 +638,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'mature', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->mature );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->mature );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'mature' stays the same.
update_blog_status( $blog_id, 'mature', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->mature );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->mature );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 );
}
@@ -661,15 +661,15 @@ if ( is_multisite() ) :
update_blog_status( $blog_id, 'public', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->public );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->public );
+ $this->assertSame( 1, $test_action_counter );
// The action should not fire if the status of 'mature' stays the same.
update_blog_status( $blog_id, 'public', 0 );
$blog = get_site( $blog_id );
- $this->assertEquals( '0', $blog->public );
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( '0', $blog->public );
+ $this->assertSame( 1, $test_action_counter );
remove_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 );
}
@@ -680,10 +680,10 @@ if ( is_multisite() ) :
function test_posts_count() {
self::factory()->post->create();
$post2 = self::factory()->post->create();
- $this->assertEquals( 2, get_site()->post_count );
+ $this->assertSame( 2, get_site()->post_count );
wp_delete_post( $post2 );
- $this->assertEquals( 1, get_site()->post_count );
+ $this->assertSame( 1, get_site()->post_count );
}
/**
@@ -692,11 +692,11 @@ if ( is_multisite() ) :
function test_blog_details_cache_invalidation() {
update_option( 'blogname', 'foo' );
$details = get_site( get_current_blog_id() );
- $this->assertEquals( 'foo', $details->blogname );
+ $this->assertSame( 'foo', $details->blogname );
update_option( 'blogname', 'bar' );
$details = get_site( get_current_blog_id() );
- $this->assertEquals( 'bar', $details->blogname );
+ $this->assertSame( 'bar', $details->blogname );
}
/**
@@ -709,8 +709,8 @@ if ( is_multisite() ) :
$key = md5( $details->domain . $details->path );
// Test the original response and cached response for the newly created site.
- $this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) );
- $this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertSame( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) );
+ $this->assertSame( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) );
}
/**
@@ -725,7 +725,7 @@ if ( is_multisite() ) :
);
$details = get_site( $blog_id );
- $this->assertEquals( $blog_id, get_blog_id_from_url( strtoupper( $details->domain ), strtoupper( $details->path ) ) );
+ $this->assertSame( $blog_id, get_blog_id_from_url( strtoupper( $details->domain ), strtoupper( $details->path ) ) );
}
/**
@@ -735,8 +735,8 @@ if ( is_multisite() ) :
$blog_id = self::factory()->blog->create( array( 'path' => '/xyz' ) );
$details = get_site( $blog_id );
- $this->assertEquals( 0, get_blog_id_from_url( $details->domain, 'foo' ) );
- $this->assertEquals( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) );
+ $this->assertSame( 0, get_blog_id_from_url( $details->domain, 'foo' ) );
+ $this->assertSame( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) );
}
/**
@@ -749,8 +749,8 @@ if ( is_multisite() ) :
$key = md5( $details->domain . $details->path );
wpmu_delete_blog( $blog_id );
- $this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) );
- $this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertSame( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) );
+ $this->assertSame( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) );
}
/**
@@ -763,9 +763,9 @@ if ( is_multisite() ) :
$key = md5( $details->domain . $details->path );
wpmu_delete_blog( $blog_id, true );
- $this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
- $this->assertEquals( 0, get_blog_id_from_url( $details->domain, $details->path ) );
- $this->assertEquals( -1, wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) );
+ $this->assertSame( 0, get_blog_id_from_url( $details->domain, $details->path ) );
+ $this->assertSame( -1, wp_cache_get( $key, 'blog-id-cache' ) );
}
/**
@@ -810,26 +810,26 @@ if ( is_multisite() ) :
$site = get_current_site();
$info = wp_upload_dir();
- $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );
- $this->assertEquals( gmstrftime( '/%Y/%m' ), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
+ $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );
+ $this->assertSame( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );
+ $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );
+ $this->assertFalse( $info['error'] );
$blog_id = self::factory()->blog->create();
switch_to_blog( $blog_id );
$info = wp_upload_dir();
- $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime( '%Y/%m' ), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime( '%Y/%m' ), $info['path'] );
- $this->assertEquals( gmstrftime( '/%Y/%m' ), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
+ $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime( '%Y/%m' ), $info['url'] );
+ $this->assertSame( ABSPATH . 'wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime( '%Y/%m' ), $info['path'] );
+ $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );
+ $this->assertFalse( $info['error'] );
restore_current_blog();
$info = wp_upload_dir();
- $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );
- $this->assertEquals( gmstrftime( '/%Y/%m' ), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
+ $this->assertSame( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['url'] );
+ $this->assertSame( ABSPATH . 'wp-content/uploads/' . gmstrftime( '%Y/%m' ), $info['path'] );
+ $this->assertSame( gmstrftime( '/%Y/%m' ), $info['subdir'] );
+ $this->assertFalse( $info['error'] );
}
/**
@@ -879,13 +879,13 @@ if ( is_multisite() ) :
function test_domain_exists_with_default_site_id() {
$details = get_site( 1 );
- $this->assertEquals( 1, domain_exists( $details->domain, $details->path ) );
+ $this->assertSame( 1, domain_exists( $details->domain, $details->path ) );
}
function test_domain_exists_with_specified_site_id() {
$details = get_site( 1 );
- $this->assertEquals( 1, domain_exists( $details->domain, $details->path, $details->site_id ) );
+ $this->assertSame( 1, domain_exists( $details->domain, $details->path, $details->site_id ) );
}
/**
@@ -895,18 +895,18 @@ if ( is_multisite() ) :
function test_domain_does_not_exist_with_invalid_site_id() {
$details = get_site( 1 );
- $this->assertEquals( null, domain_exists( $details->domain, $details->path, 999 ) );
+ $this->assertNull( domain_exists( $details->domain, $details->path, 999 ) );
}
function test_invalid_domain_does_not_exist_with_default_site_id() {
- $this->assertEquals( null, domain_exists( 'foo', 'bar' ) );
+ $this->assertNull( domain_exists( 'foo', 'bar' ) );
}
function test_domain_filtered_to_exist() {
add_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
$exists = domain_exists( 'foo', 'bar' );
remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
- $this->assertEquals( 1234, $exists );
+ $this->assertSame( 1234, $exists );
}
/**
@@ -920,7 +920,7 @@ if ( is_multisite() ) :
remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
// Make sure the same result is returned with or without a trailing slash.
- $this->assertEquals( $exists1, $exists2 );
+ $this->assertSame( $exists1, $exists2 );
}
/**
@@ -928,7 +928,7 @@ if ( is_multisite() ) :
*/
function test_get_blogaddress_by_id_with_valid_id() {
$blogaddress = get_blogaddress_by_id( 1 );
- $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/', $blogaddress );
+ $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/', $blogaddress );
}
/**
@@ -936,7 +936,7 @@ if ( is_multisite() ) :
*/
function test_get_blogaddress_by_id_with_invalid_id() {
$blogaddress = get_blogaddress_by_id( 42 );
- $this->assertEquals( '', $blogaddress );
+ $this->assertSame( '', $blogaddress );
}
/**
@@ -1180,7 +1180,7 @@ if ( is_multisite() ) :
$old_count = did_action( 'clean_site_cache' );
clean_blog_cache( $site );
- $this->assertEquals( $old_count + 1, did_action( 'clean_site_cache' ) );
+ $this->assertSame( $old_count + 1, did_action( 'clean_site_cache' ) );
}
/**
@@ -1194,7 +1194,7 @@ if ( is_multisite() ) :
$suspend = wp_suspend_cache_invalidation();
clean_blog_cache( $site );
wp_suspend_cache_invalidation( $suspend );
- $this->assertEquals( $old_count, did_action( 'clean_site_cache' ) );
+ $this->assertSame( $old_count, did_action( 'clean_site_cache' ) );
}
/**
@@ -1204,7 +1204,7 @@ if ( is_multisite() ) :
$old_count = did_action( 'clean_site_cache' );
clean_blog_cache( null );
- $this->assertEquals( $old_count, did_action( 'clean_site_cache' ) );
+ $this->assertSame( $old_count, did_action( 'clean_site_cache' ) );
}
/**
@@ -1214,7 +1214,7 @@ if ( is_multisite() ) :
$old_count = did_action( 'clean_site_cache' );
clean_blog_cache( 'something' );
- $this->assertEquals( $old_count, did_action( 'clean_site_cache' ) );
+ $this->assertSame( $old_count, did_action( 'clean_site_cache' ) );
}
/**
@@ -1443,7 +1443,7 @@ if ( is_multisite() ) :
} elseif ( 'last_updated' === $key ) {
$this->assertTrue( $old_site->last_updated <= $value );
} else {
- $this->assertEquals( $old_site->$key, $value );
+ $this->assertSame( $old_site->$key, $value );
}
}
}
@@ -1540,7 +1540,7 @@ if ( is_multisite() ) :
$result = wp_delete_site( $site_id );
$this->assertInstanceOf( 'WP_Site', $result );
- $this->assertEquals( $result->to_array(), $site->to_array() );
+ $this->assertSame( $result->to_array(), $site->to_array() );
}
/**
@@ -2116,8 +2116,8 @@ if ( is_multisite() ) :
$this->assertTrue( $result );
$this->assertTrue( $initialized );
- $this->assertEquals( $expected_options, $options );
- $this->assertEquals( $expected_meta, $meta );
+ $this->assertSame( $expected_options, $options );
+ $this->assertSame( $expected_meta, $meta );
}
public function data_wp_initialize_site() {
@@ -2214,7 +2214,7 @@ if ( is_multisite() ) :
$this->assertTrue( $result );
$this->assertTrue( $user_is_admin );
- $this->assertEquals( get_userdata( 1 )->user_email, $admin_email );
+ $this->assertSame( get_userdata( 1 )->user_email, $admin_email );
}
/**
@@ -2370,8 +2370,8 @@ if ( is_multisite() ) :
// Should not hit blog_details cache initialised in $this->populate_options_callback tirggered during
// populate_options callback's call of get_blog_details.
- $this->assertEquals( 'http://testsite1.example.org/test', get_blog_details( $blog_id )->siteurl );
- $this->assertEquals( 'http://testsite1.example.org/test', get_site( $blog_id )->siteurl );
+ $this->assertSame( 'http://testsite1.example.org/test', get_blog_details( $blog_id )->siteurl );
+ $this->assertSame( 'http://testsite1.example.org/test', get_site( $blog_id )->siteurl );
remove_action( 'populate_options', array( $this, 'populate_options_callback' ) );
}
diff --git a/tests/phpunit/tests/multisite/siteMeta.php b/tests/phpunit/tests/multisite/siteMeta.php
index 3eee11eb97..dd46058e2f 100644
--- a/tests/phpunit/tests/multisite/siteMeta.php
+++ b/tests/phpunit/tests/multisite/siteMeta.php
@@ -186,13 +186,13 @@ if ( is_multisite() ) :
add_site_meta( self::$site_id, 'unique_delete_by_key', 'value', true );
add_site_meta( self::$site_id2, 'unique_delete_by_key', 'value', true );
- $this->assertEquals( 'value', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
- $this->assertEquals( 'value', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
+ $this->assertSame( 'value', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
+ $this->assertSame( 'value', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
$this->assertTrue( delete_site_meta_by_key( 'unique_delete_by_key' ) );
- $this->assertEquals( '', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
- $this->assertEquals( '', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
+ $this->assertSame( '', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
+ $this->assertSame( '', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
}
public function test_site_meta_should_be_deleted_when_site_is_deleted() {
diff --git a/tests/phpunit/tests/multisite/siteQuery.php b/tests/phpunit/tests/multisite/siteQuery.php
index ecabdbc8db..def4f7d824 100644
--- a/tests/phpunit/tests/multisite/siteQuery.php
+++ b/tests/phpunit/tests/multisite/siteQuery.php
@@ -135,7 +135,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( 3, count( $found ) );
+ $this->assertSame( 3, count( $found ) );
}
public function test_wp_site_query_by_site__in_with_single_id() {
@@ -181,7 +181,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( 2, $found );
+ $this->assertSame( 2, $found );
}
public function test_wp_site_query_by_site__not_in_with_single_id() {
@@ -237,7 +237,7 @@ if ( is_multisite() ) :
self::$site_ids['wordpress.org/foo/bar/'],
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
$found = $q->query(
array(
@@ -248,7 +248,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( array_reverse( $expected ), $found );
+ $this->assertSame( array_reverse( $expected ), $found );
}
public function test_wp_site_query_by_network_id_with_existing_sites() {
@@ -698,7 +698,7 @@ if ( is_multisite() ) :
self::$site_ids['make.wordpress.org/foo/'],
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_wp_site_query_by_search_with_text_in_path_exclude_domain_from_search() {
@@ -715,7 +715,7 @@ if ( is_multisite() ) :
self::$site_ids['www.w.org/make/'],
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_wp_site_query_by_search_with_text_in_domain_exclude_path_from_search() {
@@ -733,7 +733,7 @@ if ( is_multisite() ) :
self::$site_ids['make.wordpress.org/foo/'],
);
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
}
public function test_wp_site_query_by_search_with_wildcard_in_text() {
@@ -814,7 +814,7 @@ if ( is_multisite() ) :
)
);
- $this->assertEquals( $number_of_queries, $wpdb->num_queries );
+ $this->assertSame( $number_of_queries, $wpdb->num_queries );
}
/**
@@ -844,7 +844,7 @@ if ( is_multisite() ) :
'count' => true,
)
);
- $this->assertEquals( $number_of_queries, $wpdb->num_queries );
+ $this->assertSame( $number_of_queries, $wpdb->num_queries );
}
/**
@@ -874,7 +874,7 @@ if ( is_multisite() ) :
'count' => true,
)
);
- $this->assertEquals( $number_of_queries + 1, $wpdb->num_queries );
+ $this->assertSame( $number_of_queries + 1, $wpdb->num_queries );
}
/**
@@ -903,7 +903,7 @@ if ( is_multisite() ) :
}
if ( $strict ) {
- $this->assertEquals( $expected, $found );
+ $this->assertSame( $expected, $found );
} else {
$this->assertEqualSets( $expected, $found );
}
@@ -933,7 +933,7 @@ if ( is_multisite() ) :
$this->assertSame( array( 555 ), $results );
// Make sure manually setting total_users doesn't get overwritten.
- $this->assertEquals( 1, $q->found_sites );
+ $this->assertSame( 1, $q->found_sites );
}
public static function filter_sites_pre_query( $sites, $query ) {
diff --git a/tests/phpunit/tests/multisite/updateBlogDetails.php b/tests/phpunit/tests/multisite/updateBlogDetails.php
index 48c3b7cdd8..c3bd0e3cdf 100644
--- a/tests/phpunit/tests/multisite/updateBlogDetails.php
+++ b/tests/phpunit/tests/multisite/updateBlogDetails.php
@@ -39,9 +39,9 @@ if ( is_multisite() ) :
$blog = get_site( $blog_id );
- $this->assertEquals( 'example.com', $blog->domain );
- $this->assertEquals( '/my_path/', $blog->path );
- $this->assertEquals( '0', $blog->spam );
+ $this->assertSame( 'example.com', $blog->domain );
+ $this->assertSame( '/my_path/', $blog->path );
+ $this->assertSame( '0', $blog->spam );
}
/**
@@ -71,16 +71,16 @@ if ( is_multisite() ) :
update_blog_details( $blog_id, array( $flag => $flag_value ) );
$blog = get_site( $blog_id );
- $this->assertEquals( $flag_value, $blog->{$flag} );
+ $this->assertSame( $flag_value, $blog->{$flag} );
// The hook attached to this flag should have fired once during update_blog_details().
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter );
// Update the site to the exact same flag value for this flag.
update_blog_details( $blog_id, array( $flag => $flag_value ) );
// The hook attached to this flag should not have fired again.
- $this->assertEquals( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter );
remove_action( $hook, array( $this, '_action_counter_cb' ), 10 );
}
@@ -116,7 +116,7 @@ if ( is_multisite() ) :
update_blog_details( 1, array( 'path' => $path ) );
$site = get_site( 1 );
- $this->assertEquals( $expected, $site->path );
+ $this->assertSame( $expected, $site->path );
}
public function data_single_directory_path() {
diff --git a/tests/phpunit/tests/multisite/wpGetSites.php b/tests/phpunit/tests/multisite/wpGetSites.php
index 3a068e87e5..700b8d21c1 100644
--- a/tests/phpunit/tests/multisite/wpGetSites.php
+++ b/tests/phpunit/tests/multisite/wpGetSites.php
@@ -72,7 +72,7 @@ if ( is_multisite() ) :
$missing_keys = array_diff_key( array_flip( $keys ), $sites[0] );
- $this->assertEquals( array(), $missing_keys, 'Keys are missing from site arrays.' );
+ $this->assertSame( array(), $missing_keys, 'Keys are missing from site arrays.' );
}
/**
diff --git a/tests/phpunit/tests/multisite/wpInstallDefaults.php b/tests/phpunit/tests/multisite/wpInstallDefaults.php
index dad6a99b84..05371f2159 100644
--- a/tests/phpunit/tests/multisite/wpInstallDefaults.php
+++ b/tests/phpunit/tests/multisite/wpInstallDefaults.php
@@ -76,8 +76,8 @@ if ( is_multisite() ) :
wp_delete_site( $blog_id );
- $this->assertEquals( 'Some page content', $first_page->post_content );
- $this->assertEquals( 'Some comment content', $first_comment[0]->comment_content );
+ $this->assertSame( 'Some page content', $first_page->post_content );
+ $this->assertSame( 'Some comment content', $first_comment[0]->comment_content );
}
}
diff --git a/tests/phpunit/tests/oembed/WpEmbed.php b/tests/phpunit/tests/oembed/WpEmbed.php
index 86f3c32d3a..ac5e694d44 100644
--- a/tests/phpunit/tests/oembed/WpEmbed.php
+++ b/tests/phpunit/tests/oembed/WpEmbed.php
@@ -109,7 +109,7 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$content = "\nhttp://example.com/embed/foo\n";
$actual = $this->wp_embed->autoembed( $content );
- $this->assertEquals( $content, $actual );
+ $this->assertSame( $content, $actual );
}
public function test_autoembed_should_return_modified_content() {
@@ -124,7 +124,7 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$actual = $GLOBALS['wp_embed']->autoembed( $content );
wp_embed_unregister_handler( $handle );
- $this->assertEquals( "\nEmbedded http://example.com/embed/foo\n", $actual );
+ $this->assertSame( "\nEmbedded http://example.com/embed/foo\n", $actual );
}
public function test_delete_oembed_caches() {
@@ -136,8 +136,8 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$this->wp_embed->delete_oembed_caches( $post_id );
- $this->assertEquals( array(), get_post_meta( $post_id, '_oembed_foo' ) );
- $this->assertEquals( array(), get_post_meta( $post_id, '_oembed_baz' ) );
+ $this->assertSame( array(), get_post_meta( $post_id, '_oembed_foo' ) );
+ $this->assertSame( array(), get_post_meta( $post_id, '_oembed_baz' ) );
}
public function test_cache_oembed_invalid_post_type() {
@@ -168,7 +168,7 @@ class Tests_WP_Embed extends WP_UnitTestCase {
remove_filter( 'pre_oembed_result', array( $this, '_pre_oembed_result_callback' ) );
$this->assertSame( $post_id, $this->wp_embed->post_ID );
- $this->assertEquals( $expected, get_post_meta( $post_id, $cachekey, true ) );
+ $this->assertSame( $expected, get_post_meta( $post_id, $cachekey, true ) );
$this->assertNotEmpty( get_post_meta( $post_id, $cachekey_time, true ) );
}
@@ -194,9 +194,9 @@ class Tests_WP_Embed extends WP_UnitTestCase {
// Cleanup.
unset( $post );
- $this->assertEquals( $expected, $actual );
- $this->assertEquals( $expected, $actual_2 );
- $this->assertEquals( $expected, $cached );
+ $this->assertSame( $expected, $actual );
+ $this->assertSame( $expected, $actual_2 );
+ $this->assertSame( $expected, $cached );
}
public function test_shortcode_should_get_cached_failure_from_post_meta_for_known_post() {
@@ -225,10 +225,10 @@ class Tests_WP_Embed extends WP_UnitTestCase {
// Cleanup.
unset( $post );
- $this->assertEquals( $expected, $actual );
- $this->assertEquals( '{{unknown}}', $cached );
+ $this->assertSame( $expected, $actual );
+ $this->assertSame( '{{unknown}}', $cached );
$this->assertEmpty( $cached_time );
- $this->assertEquals( $expected, $actual_2 );
+ $this->assertSame( $expected, $actual_2 );
}
/**
@@ -252,9 +252,9 @@ class Tests_WP_Embed extends WP_UnitTestCase {
wp_delete_post( $oembed_post_id );
$this->assertNotNull( $oembed_post_id );
- $this->assertEquals( $expected, $post_content );
- $this->assertEquals( $expected, $actual );
- $this->assertEquals( $expected, $actual_2 );
+ $this->assertSame( $expected, $post_content );
+ $this->assertSame( $expected, $actual );
+ $this->assertSame( $expected, $actual_2 );
}
/**
@@ -277,10 +277,10 @@ class Tests_WP_Embed extends WP_UnitTestCase {
wp_delete_post( $oembed_post_id );
- $this->assertEquals( $expected, $actual );
- $this->assertEquals( $expected, $actual_2 );
+ $this->assertSame( $expected, $actual );
+ $this->assertSame( $expected, $actual_2 );
$this->assertNotNull( $oembed_post_id );
- $this->assertEquals( '{{unknown}}', $post_content );
+ $this->assertSame( '{{unknown}}', $post_content );
}
/**
@@ -321,7 +321,7 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->shortcode( array( 'src' => $url ) );
- $this->assertEquals( '' . esc_html( $url ) . '', $actual );
+ $this->assertSame( '' . esc_html( $url ) . '', $actual );
}
public function test_shortcode_should_return_empty_string_for_missing_url() {
@@ -332,20 +332,20 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->shortcode( array(), $url );
- $this->assertEquals( '' . esc_html( $url ) . '', $actual );
+ $this->assertSame( '' . esc_html( $url ) . '', $actual );
}
public function test_run_shortcode_url_only() {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->run_shortcode( '[embed]' . $url . '[/embed]' );
- $this->assertEquals( '' . esc_html( $url ) . '', $actual );
+ $this->assertSame( '' . esc_html( $url ) . '', $actual );
}
public function test_maybe_make_link() {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->maybe_make_link( $url );
- $this->assertEquals( '' . esc_html( $url ) . '', $actual );
+ $this->assertSame( '' . esc_html( $url ) . '', $actual );
}
public function test_maybe_make_link_return_false_on_fail() {
@@ -357,6 +357,6 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$url = 'http://example.com/';
$this->wp_embed->linkifunknown = false;
- $this->assertEquals( $url, $this->wp_embed->maybe_make_link( $url ) );
+ $this->assertSame( $url, $this->wp_embed->maybe_make_link( $url ) );
}
}
diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php
index 72b3aed0bf..3facaf0c97 100644
--- a/tests/phpunit/tests/oembed/controller.php
+++ b/tests/phpunit/tests/oembed/controller.php
@@ -175,11 +175,11 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
}
function test_wp_oembed_ensure_format() {
- $this->assertEquals( 'json', wp_oembed_ensure_format( 'json' ) );
- $this->assertEquals( 'xml', wp_oembed_ensure_format( 'xml' ) );
- $this->assertEquals( 'json', wp_oembed_ensure_format( 123 ) );
- $this->assertEquals( 'json', wp_oembed_ensure_format( 'random' ) );
- $this->assertEquals( 'json', wp_oembed_ensure_format( array() ) );
+ $this->assertSame( 'json', wp_oembed_ensure_format( 'json' ) );
+ $this->assertSame( 'xml', wp_oembed_ensure_format( 'xml' ) );
+ $this->assertSame( 'json', wp_oembed_ensure_format( 123 ) );
+ $this->assertSame( 'json', wp_oembed_ensure_format( 'random' ) );
+ $this->assertSame( 'json', wp_oembed_ensure_format( array() ) );
}
function test_oembed_create_xml() {
@@ -265,7 +265,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
- $this->assertEquals( 'rest_no_route', $data['code'] );
+ $this->assertSame( 'rest_no_route', $data['code'] );
}
function test_request_without_url_param() {
@@ -274,8 +274,8 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
- $this->assertEquals( 'rest_missing_callback_param', $data['code'] );
- $this->assertEquals( 'url', $data['data']['params'][0] );
+ $this->assertSame( 'rest_missing_callback_param', $data['code'] );
+ $this->assertSame( 'url', $data['data']['params'][0] );
}
function test_request_with_bad_url() {
@@ -285,7 +285,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
- $this->assertEquals( 'oembed_invalid_url', $data['code'] );
+ $this->assertSame( 'oembed_invalid_url', $data['code'] );
}
function test_request_invalid_format() {
@@ -334,13 +334,13 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$this->assertArrayHasKey( 'type', $data );
$this->assertArrayHasKey( 'width', $data );
- $this->assertEquals( '1.0', $data['version'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
- $this->assertEquals( home_url(), $data['provider_url'] );
- $this->assertEquals( $user->display_name, $data['author_name'] );
- $this->assertEquals( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
- $this->assertEquals( $post->post_title, $data['title'] );
- $this->assertEquals( 'rich', $data['type'] );
+ $this->assertSame( '1.0', $data['version'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['provider_name'] );
+ $this->assertSame( home_url(), $data['provider_url'] );
+ $this->assertSame( $user->display_name, $data['author_name'] );
+ $this->assertSame( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
+ $this->assertSame( $post->post_title, $data['title'] );
+ $this->assertSame( 'rich', $data['type'] );
$this->assertTrue( $data['width'] <= $request['maxwidth'] );
}
@@ -377,13 +377,13 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$this->assertArrayHasKey( 'type', $data );
$this->assertArrayHasKey( 'width', $data );
- $this->assertEquals( '1.0', $data['version'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
- $this->assertEquals( home_url(), $data['provider_url'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['author_name'] );
- $this->assertEquals( home_url(), $data['author_url'] );
- $this->assertEquals( $post->post_title, $data['title'] );
- $this->assertEquals( 'rich', $data['type'] );
+ $this->assertSame( '1.0', $data['version'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['provider_name'] );
+ $this->assertSame( home_url(), $data['provider_url'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['author_name'] );
+ $this->assertSame( home_url(), $data['author_url'] );
+ $this->assertSame( $post->post_title, $data['title'] );
+ $this->assertSame( 'rich', $data['type'] );
$this->assertTrue( $data['width'] <= $request['maxwidth'] );
update_option( 'show_on_front', 'posts' );
@@ -422,13 +422,13 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$this->assertArrayHasKey( 'type', $data );
$this->assertArrayHasKey( 'width', $data );
- $this->assertEquals( '1.0', $data['version'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
- $this->assertEquals( home_url(), $data['provider_url'] );
- $this->assertEquals( $user->display_name, $data['author_name'] );
- $this->assertEquals( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
- $this->assertEquals( $post->post_title, $data['title'] );
- $this->assertEquals( 'rich', $data['type'] );
+ $this->assertSame( '1.0', $data['version'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['provider_name'] );
+ $this->assertSame( home_url(), $data['provider_url'] );
+ $this->assertSame( $user->display_name, $data['author_name'] );
+ $this->assertSame( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
+ $this->assertSame( $post->post_title, $data['title'] );
+ $this->assertSame( 'rich', $data['type'] );
$this->assertTrue( $data['width'] <= $request['maxwidth'] );
}
@@ -508,30 +508,30 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
}
function test_get_oembed_endpoint_url() {
- $this->assertEquals( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url() );
- $this->assertEquals( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'json' ) );
- $this->assertEquals( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) );
+ $this->assertSame( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url() );
+ $this->assertSame( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'json' ) );
+ $this->assertSame( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) );
$post_id = $this->factory()->post->create();
$url = get_permalink( $post_id );
$url_encoded = urlencode( $url );
- $this->assertEquals( home_url() . '/index.php?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded, get_oembed_endpoint_url( $url ) );
- $this->assertEquals( home_url() . '/index.php?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );
+ $this->assertSame( home_url() . '/index.php?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded, get_oembed_endpoint_url( $url ) );
+ $this->assertSame( home_url() . '/index.php?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );
}
function test_get_oembed_endpoint_url_pretty_permalinks() {
update_option( 'permalink_structure', '/%postname%' );
- $this->assertEquals( home_url() . '/wp-json/oembed/1.0/embed', get_oembed_endpoint_url() );
- $this->assertEquals( home_url() . '/wp-json/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) );
+ $this->assertSame( home_url() . '/wp-json/oembed/1.0/embed', get_oembed_endpoint_url() );
+ $this->assertSame( home_url() . '/wp-json/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) );
$post_id = $this->factory()->post->create();
$url = get_permalink( $post_id );
$url_encoded = urlencode( $url );
- $this->assertEquals( home_url() . '/wp-json/oembed/1.0/embed?url=' . $url_encoded, get_oembed_endpoint_url( $url ) );
- $this->assertEquals( home_url() . '/wp-json/oembed/1.0/embed?url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );
+ $this->assertSame( home_url() . '/wp-json/oembed/1.0/embed?url=' . $url_encoded, get_oembed_endpoint_url( $url ) );
+ $this->assertSame( home_url() . '/wp-json/oembed/1.0/embed?url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );
update_option( 'permalink_structure', '' );
}
@@ -541,7 +541,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 400, $response->get_status() );
+ $this->assertSame( 400, $response->get_status() );
// Test with a user that does not have edit_posts capability.
wp_set_current_user( self::$subscriber );
@@ -549,9 +549,9 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request->set_param( 'url', self::INVALID_OEMBED_URL );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 403, $response->get_status() );
+ $this->assertSame( 403, $response->get_status() );
$data = $response->get_data();
- $this->assertEquals( $data['code'], 'rest_forbidden' );
+ $this->assertSame( $data['code'], 'rest_forbidden' );
}
public function test_proxy_with_invalid_oembed_provider() {
@@ -559,9 +559,9 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
$request->set_param( 'url', self::INVALID_OEMBED_URL );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 404, $response->get_status() );
+ $this->assertSame( 404, $response->get_status() );
$data = $response->get_data();
- $this->assertEquals( 'oembed_invalid_url', $data['code'] );
+ $this->assertSame( 'oembed_invalid_url', $data['code'] );
}
public function test_proxy_with_invalid_type() {
@@ -570,7 +570,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request->set_param( 'type', 'xml' );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 400, $response->get_status() );
+ $this->assertSame( 400, $response->get_status() );
}
public function test_proxy_with_valid_oembed_provider() {
@@ -581,12 +581,12 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request->set_param( 'maxheight', 789 );
$request->set_param( '_wpnonce', wp_create_nonce( 'wp_rest' ) );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 200, $response->get_status() );
- $this->assertEquals( 1, $this->request_count );
+ $this->assertSame( 200, $response->get_status() );
+ $this->assertSame( 1, $this->request_count );
// Subsequent request is cached and so it should not cause a request.
rest_get_server()->dispatch( $request );
- $this->assertEquals( 1, $this->request_count );
+ $this->assertSame( 1, $this->request_count );
// Rest with another user should also be cached.
wp_set_current_user( self::$administrator );
@@ -596,15 +596,15 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request->set_param( 'maxwidth', 456 );
$request->set_param( 'maxheight', 789 );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 1, $this->request_count );
+ $this->assertSame( 1, $this->request_count );
// Test data object.
$data = $response->get_data();
$this->assertNotEmpty( $data );
$this->assertInternalType( 'object', $data );
- $this->assertEquals( 'YouTube', $data->provider_name );
- $this->assertEquals( 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg', $data->thumbnail_url );
+ $this->assertSame( 'YouTube', $data->provider_name );
+ $this->assertSame( 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg', $data->thumbnail_url );
$this->assertEquals( $data->width, $request['maxwidth'] );
$this->assertEquals( $data->height, $request['maxheight'] );
}
@@ -622,8 +622,8 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request->set_param( 'maxheight', 789 );
$request->set_param( '_wpnonce', wp_create_nonce( 'wp_rest' ) );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 200, $response->get_status() );
- $this->assertEquals( 2, $this->request_count );
+ $this->assertSame( 200, $response->get_status() );
+ $this->assertSame( 2, $this->request_count );
// Test data object.
$data = $response->get_data();
@@ -642,8 +642,8 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request->set_param( 'url', self::INVALID_OEMBED_URL );
$request->set_param( 'discover', false );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 404, $response->get_status() );
- $this->assertEquals( 0, $this->request_count );
+ $this->assertSame( 404, $response->get_status() );
+ $this->assertSame( 0, $this->request_count );
}
public function test_proxy_with_invalid_oembed_provider_with_default_discover_param() {
@@ -653,8 +653,8 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
$request->set_param( 'url', self::INVALID_OEMBED_URL );
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 404, $response->get_status() );
- $this->assertEquals( 1, $this->request_count );
+ $this->assertSame( 404, $response->get_status() );
+ $this->assertSame( 1, $this->request_count );
}
public function test_proxy_with_invalid_discover_param() {
@@ -665,9 +665,9 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$response = rest_get_server()->dispatch( $request );
- $this->assertEquals( 400, $response->get_status() );
+ $this->assertSame( 400, $response->get_status() );
$data = $response->get_data();
- $this->assertEquals( $data['code'], 'rest_invalid_param' );
+ $this->assertSame( $data['code'], 'rest_invalid_param' );
}
/**
@@ -708,13 +708,13 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$this->assertArrayHasKey( 'type', $data );
$this->assertArrayHasKey( 'width', $data );
- $this->assertEquals( '1.0', $data['version'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
- $this->assertEquals( home_url(), $data['provider_url'] );
- $this->assertEquals( $user->display_name, $data['author_name'] );
- $this->assertEquals( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
- $this->assertEquals( $post->post_title, $data['title'] );
- $this->assertEquals( 'rich', $data['type'] );
+ $this->assertSame( '1.0', $data['version'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['provider_name'] );
+ $this->assertSame( home_url(), $data['provider_url'] );
+ $this->assertSame( $user->display_name, $data['author_name'] );
+ $this->assertSame( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
+ $this->assertSame( $post->post_title, $data['title'] );
+ $this->assertSame( 'rich', $data['type'] );
$this->assertTrue( $data['width'] <= $request['maxwidth'] );
}
@@ -757,13 +757,13 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$this->assertArrayHasKey( 'type', $data );
$this->assertArrayHasKey( 'width', $data );
- $this->assertEquals( '1.0', $data['version'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
- $this->assertEquals( home_url(), $data['provider_url'] );
- $this->assertEquals( get_bloginfo( 'name' ), $data['author_name'] );
- $this->assertEquals( home_url(), $data['author_url'] );
- $this->assertEquals( $post->post_title, $data['title'] );
- $this->assertEquals( 'rich', $data['type'] );
+ $this->assertSame( '1.0', $data['version'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['provider_name'] );
+ $this->assertSame( home_url(), $data['provider_url'] );
+ $this->assertSame( get_bloginfo( 'name' ), $data['author_name'] );
+ $this->assertSame( home_url(), $data['author_url'] );
+ $this->assertSame( $post->post_title, $data['title'] );
+ $this->assertSame( 'rich', $data['type'] );
$this->assertTrue( $data['width'] <= $request['maxwidth'] );
update_option( 'show_on_front', 'posts' );
@@ -784,11 +784,11 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
- $this->assertEquals( 1, $this->oembed_result_filter_count );
+ $this->assertSame( 1, $this->oembed_result_filter_count );
$this->assertInternalType( 'object', $data );
- $this->assertEquals( 'Untrusted', $data->provider_name );
- $this->assertEquals( self::UNTRUSTED_PROVIDER_URL, $data->provider_url );
- $this->assertEquals( 'rich', $data->type );
+ $this->assertSame( 'Untrusted', $data->provider_name );
+ $this->assertSame( self::UNTRUSTED_PROVIDER_URL, $data->provider_url );
+ $this->assertSame( 'rich', $data->type );
$this->assertFalse( $data->html );
}
@@ -807,7 +807,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
- $this->assertEquals( 1, $this->oembed_result_filter_count );
+ $this->assertSame( 1, $this->oembed_result_filter_count );
$this->assertInternalType( 'object', $data );
$this->assertStringStartsWith( 'Unfiltered', $data->html );
diff --git a/tests/phpunit/tests/oembed/discovery.php b/tests/phpunit/tests/oembed/discovery.php
index 19f9ee2f61..db435490a4 100644
--- a/tests/phpunit/tests/oembed/discovery.php
+++ b/tests/phpunit/tests/oembed/discovery.php
@@ -48,7 +48,7 @@ class Tests_oEmbed_Discovery extends WP_UnitTestCase {
$expected = '' . "\n";
$expected .= '' . "\n";
- $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
+ $this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
}
function test_add_oembed_discovery_links_to_page() {
@@ -63,7 +63,7 @@ class Tests_oEmbed_Discovery extends WP_UnitTestCase {
$expected = '' . "\n";
$expected .= '' . "\n";
- $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
+ $this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
}
function test_add_oembed_discovery_links_to_attachment() {
@@ -83,6 +83,6 @@ class Tests_oEmbed_Discovery extends WP_UnitTestCase {
$expected = '' . "\n";
$expected .= '' . "\n";
- $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
+ $this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
}
}
diff --git a/tests/phpunit/tests/oembed/filterResult.php b/tests/phpunit/tests/oembed/filterResult.php
index 1b93b07040..06ed74532a 100644
--- a/tests/phpunit/tests/oembed/filterResult.php
+++ b/tests/phpunit/tests/oembed/filterResult.php
@@ -9,7 +9,7 @@ class Tests_Filter_oEmbed_Result extends WP_UnitTestCase {
$actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' );
- $this->assertEquals( $html, $actual );
+ $this->assertSame( $html, $actual );
}
function test_filter_oembed_result_with_untrusted_provider() {
@@ -21,14 +21,14 @@ class Tests_Filter_oEmbed_Result extends WP_UnitTestCase {
$this->assertTrue( isset( $matches[1] ) );
$this->assertTrue( isset( $matches[2] ) );
- $this->assertEquals( $matches[1], $matches[2] );
+ $this->assertSame( $matches[1], $matches[2] );
}
function test_filter_oembed_result_only_one_iframe_is_allowed() {
$html = '';
$actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
- $this->assertEquals( '', $actual );
+ $this->assertSame( '', $actual );
}
function test_filter_oembed_result_with_newlines() {
@@ -41,7 +41,7 @@ EOD;
$actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
- $this->assertEquals( '', $actual );
+ $this->assertSame( '', $actual );
}
function test_filter_oembed_result_without_iframe() {
@@ -65,13 +65,13 @@ EOD;
$this->assertTrue( isset( $matches[1] ) );
$this->assertTrue( isset( $matches[2] ) );
- $this->assertEquals( $matches[1], $matches[2] );
+ $this->assertSame( $matches[1], $matches[2] );
}
function test_filter_oembed_result_wrong_type_provided() {
$actual = wp_filter_oembed_result( 'some string', (object) array( 'type' => 'link' ), '' );
- $this->assertEquals( 'some string', $actual );
+ $this->assertSame( 'some string', $actual );
}
function test_filter_oembed_result_invalid_result() {
@@ -83,14 +83,14 @@ EOD;
$html = '';
$actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
- $this->assertEquals( '', $actual );
+ $this->assertSame( '', $actual );
}
function test_filter_oembed_result_allowed_html() {
$html = '
';
$actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
- $this->assertEquals( '
', $actual );
+ $this->assertSame( '
', $actual );
}
public function _data_oembed_test_strings() {
@@ -124,7 +124,7 @@ EOD;
'html' => $html,
);
$actual = _wp_oembed_get_object()->data2html( $data, 'https://untrusted.localhost' );
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
/**
@@ -134,6 +134,6 @@ EOD;
$html = '';
$actual = _oembed_filter_feed_content( wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ) );
- $this->assertEquals( '', $actual );
+ $this->assertSame( '', $actual );
}
}
diff --git a/tests/phpunit/tests/oembed/getResponseData.php b/tests/phpunit/tests/oembed/getResponseData.php
index 1941db1201..661d8ca896 100644
--- a/tests/phpunit/tests/oembed/getResponseData.php
+++ b/tests/phpunit/tests/oembed/getResponseData.php
@@ -133,8 +133,8 @@ class Tests_oEmbed_Response_Data extends WP_UnitTestCase {
$data = get_oembed_response_data( $post, 1000 );
- $this->assertEquals( 600, $data['width'] );
- $this->assertEquals( 338, $data['height'] );
+ $this->assertSame( 600, $data['width'] );
+ $this->assertSame( 338, $data['height'] );
}
function test_get_oembed_response_data_maxwidth_too_low() {
@@ -142,8 +142,8 @@ class Tests_oEmbed_Response_Data extends WP_UnitTestCase {
$data = get_oembed_response_data( $post, 100 );
- $this->assertEquals( 200, $data['width'] );
- $this->assertEquals( 200, $data['height'] );
+ $this->assertSame( 200, $data['width'] );
+ $this->assertSame( 200, $data['height'] );
}
function test_get_oembed_response_data_maxwidth_invalid() {
@@ -151,13 +151,13 @@ class Tests_oEmbed_Response_Data extends WP_UnitTestCase {
$data = get_oembed_response_data( $post, '400;" DROP TABLES' );
- $this->assertEquals( 400, $data['width'] );
- $this->assertEquals( 225, $data['height'] );
+ $this->assertSame( 400, $data['width'] );
+ $this->assertSame( 225, $data['height'] );
$data = get_oembed_response_data( $post, "lol this isn't even a number?!?!?" );
- $this->assertEquals( 200, $data['width'] );
- $this->assertEquals( 200, $data['height'] );
+ $this->assertSame( 200, $data['width'] );
+ $this->assertSame( 200, $data['height'] );
}
function test_get_oembed_response_data_with_thumbnail() {
diff --git a/tests/phpunit/tests/oembed/postEmbedUrl.php b/tests/phpunit/tests/oembed/postEmbedUrl.php
index 5432e5182b..c5613b98f1 100644
--- a/tests/phpunit/tests/oembed/postEmbedUrl.php
+++ b/tests/phpunit/tests/oembed/postEmbedUrl.php
@@ -16,7 +16,7 @@ class Tests_Post_Embed_URL extends WP_UnitTestCase {
$permalink = get_permalink( $post_id );
$embed_url = get_post_embed_url( $post_id );
- $this->assertEquals( $permalink . '/embed', $embed_url );
+ $this->assertSame( $permalink . '/embed', $embed_url );
}
function test_with_ugly_permalinks() {
@@ -24,7 +24,7 @@ class Tests_Post_Embed_URL extends WP_UnitTestCase {
$permalink = get_permalink( $post_id );
$embed_url = get_post_embed_url( $post_id );
- $this->assertEquals( $permalink . '&embed=true', $embed_url );
+ $this->assertSame( $permalink . '&embed=true', $embed_url );
}
/**
diff --git a/tests/phpunit/tests/oembed/template.php b/tests/phpunit/tests/oembed/template.php
index 2384fbabe6..0eefb8f4c0 100644
--- a/tests/phpunit/tests/oembed/template.php
+++ b/tests/phpunit/tests/oembed/template.php
@@ -211,7 +211,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
function test_wp_embed_excerpt_more_no_embed() {
$GLOBALS['wp_query'] = new WP_Query();
- $this->assertEquals( 'foo bar', wp_embed_excerpt_more( 'foo bar' ) );
+ $this->assertSame( 'foo bar', wp_embed_excerpt_more( 'foo bar' ) );
}
function test_wp_embed_excerpt_more() {
@@ -222,7 +222,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
)
);
- $this->assertEquals( '', wp_embed_excerpt_more( '' ) );
+ $this->assertSame( '', wp_embed_excerpt_more( '' ) );
$this->go_to( get_post_embed_url( $post_id ) );
@@ -233,7 +233,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
get_the_permalink()
);
- $this->assertEquals( $expected, $actual );
+ $this->assertSame( $expected, $actual );
}
function test_is_embed_post() {
diff --git a/tests/phpunit/tests/oembed/wpOembed.php b/tests/phpunit/tests/oembed/wpOembed.php
index 2c029da6b2..1f15abbad8 100644
--- a/tests/phpunit/tests/oembed/wpOembed.php
+++ b/tests/phpunit/tests/oembed/wpOembed.php
@@ -37,7 +37,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
remove_filter( 'pre_oembed_result', array( $this, '_filter_pre_oembed_result' ) );
$this->assertNotFalse( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
}
public function test_wp_filter_pre_oembed_result_prevents_http_request_when_viewing_the_post() {
@@ -52,7 +52,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
remove_filter( 'pre_oembed_result', array( $this, '_filter_pre_oembed_result' ) );
$this->assertNotFalse( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
}
public function test_wp_filter_pre_oembed_result_non_existent_post() {
@@ -84,7 +84,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
remove_filter( 'pre_oembed_result', array( $this, '_filter_pre_oembed_result' ) );
$this->assertNotNull( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
}
/**
@@ -113,7 +113,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
restore_current_blog();
$this->assertNotNull( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
}
/**
@@ -150,7 +150,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
restore_current_blog();
$this->assertNotNull( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
}
/**
@@ -177,7 +177,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
restore_current_blog();
$this->assertNotNull( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
}
/**
@@ -205,7 +205,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
restore_current_blog();
$this->assertNotNull( $this->pre_oembed_result_filtered );
- $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
+ $this->assertSame( $this->pre_oembed_result_filtered, $actual );
$this->assertSame( $expected_stack, $actual_stack );
}
diff --git a/tests/phpunit/tests/option/multisite.php b/tests/phpunit/tests/option/multisite.php
index 3ab4dd9184..49c7197431 100644
--- a/tests/phpunit/tests/option/multisite.php
+++ b/tests/phpunit/tests/option/multisite.php
@@ -35,27 +35,27 @@ if ( is_multisite() ) :
$this->assertTrue( add_blog_option( 1, $key, $value ) );
// Assert all values of $blog_id that means the current or main blog (the same here).
- $this->assertEquals( $value, get_blog_option( 1, $key ) );
- $this->assertEquals( $value, get_blog_option( null, $key ) );
- $this->assertEquals( $value, get_blog_option( '1', $key ) );
- $this->assertEquals( $value, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value, get_blog_option( 1, $key ) );
+ $this->assertSame( $value, get_blog_option( null, $key ) );
+ $this->assertSame( $value, get_blog_option( '1', $key ) );
+ $this->assertSame( $value, get_option( $key ) ); // Check get_option().
$this->assertFalse( add_blog_option( 1, $key, $value ) ); // Already exists.
$this->assertFalse( update_blog_option( 1, $key, $value ) ); // Value is the same.
$this->assertTrue( update_blog_option( 1, $key, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( 1, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( 1, $key ) );
+ $this->assertSame( $value2, get_option( $key ) ); // Check get_option().
$this->assertFalse( add_blog_option( 1, $key, $value ) );
- $this->assertEquals( $value2, get_blog_option( 1, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( 1, $key ) );
+ $this->assertSame( $value2, get_option( $key ) ); // Check get_option().
$this->assertTrue( delete_blog_option( 1, $key ) );
$this->assertFalse( get_blog_option( 1, $key ) );
$this->assertFalse( get_option( $key ) ); // Check get_option().
$this->assertFalse( delete_blog_option( 1, $key ) );
$this->assertTrue( update_blog_option( 1, $key2, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( 1, $key2 ) );
- $this->assertEquals( $value2, get_option( $key2 ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( 1, $key2 ) );
+ $this->assertSame( $value2, get_option( $key2 ) ); // Check get_option().
$this->assertTrue( delete_blog_option( 1, $key2 ) );
$this->assertFalse( get_blog_option( 1, $key2 ) );
$this->assertFalse( get_option( $key2 ) ); // Check get_option().
@@ -72,26 +72,26 @@ if ( is_multisite() ) :
$this->assertTrue( add_blog_option( null, $key, $value ) );
// Assert all values of $blog_id that means the current or main blog (the same here).
- $this->assertEquals( $value, get_blog_option( null, $key ) );
- $this->assertEquals( $value, get_blog_option( null, $key ) );
- $this->assertEquals( $value, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value, get_blog_option( null, $key ) );
+ $this->assertSame( $value, get_blog_option( null, $key ) );
+ $this->assertSame( $value, get_option( $key ) ); // Check get_option().
$this->assertFalse( add_blog_option( null, $key, $value ) ); // Already exists.
$this->assertFalse( update_blog_option( null, $key, $value ) ); // Value is the same.
$this->assertTrue( update_blog_option( null, $key, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( null, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( null, $key ) );
+ $this->assertSame( $value2, get_option( $key ) ); // Check get_option().
$this->assertFalse( add_blog_option( null, $key, $value ) );
- $this->assertEquals( $value2, get_blog_option( null, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( null, $key ) );
+ $this->assertSame( $value2, get_option( $key ) ); // Check get_option().
$this->assertTrue( delete_blog_option( null, $key ) );
$this->assertFalse( get_blog_option( null, $key ) );
$this->assertFalse( get_option( $key ) ); // Check get_option().
$this->assertFalse( delete_blog_option( null, $key ) );
$this->assertTrue( update_blog_option( null, $key2, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( null, $key2 ) );
- $this->assertEquals( $value2, get_option( $key2 ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( null, $key2 ) );
+ $this->assertSame( $value2, get_option( $key2 ) ); // Check get_option().
$this->assertTrue( delete_blog_option( null, $key2 ) );
$this->assertFalse( get_blog_option( null, $key2 ) );
$this->assertFalse( get_option( $key2 ) ); // Check get_option().
@@ -119,26 +119,26 @@ if ( is_multisite() ) :
$this->assertTrue( add_blog_option( $blog_id, $key, $value ) );
// Assert all values of $blog_id that means the current or main blog (the same here).
- $this->assertEquals( $value, get_blog_option( $blog_id, $key ) );
- $this->assertEquals( $value, get_blog_option( "$blog_id", $key ) );
- // $this->assertEquals( $value, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value, get_blog_option( $blog_id, $key ) );
+ $this->assertSame( $value, get_blog_option( "$blog_id", $key ) );
+ // $this->assertSame( $value, get_option( $key ) ); // Check get_option().
$this->assertFalse( add_blog_option( $blog_id, $key, $value ) ); // Already exists.
$this->assertFalse( update_blog_option( $blog_id, $key, $value ) ); // Value is the same.
$this->assertTrue( update_blog_option( $blog_id, $key, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( $blog_id, $key ) );
- // $this->assertEquals( $value2, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( $blog_id, $key ) );
+ // $this->assertSame( $value2, get_option( $key ) ); // Check get_option().
$this->assertFalse( add_blog_option( $blog_id, $key, $value ) );
- $this->assertEquals( $value2, get_blog_option( $blog_id, $key ) );
- // $this->assertEquals( $value2, get_option( $key ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( $blog_id, $key ) );
+ // $this->assertSame( $value2, get_option( $key ) ); // Check get_option().
$this->assertTrue( delete_blog_option( $blog_id, $key ) );
$this->assertFalse( get_blog_option( $blog_id, $key ) );
// $this->assertFalse( get_option( $key ) ); // Check get_option().
$this->assertFalse( delete_blog_option( $blog_id, $key ) );
$this->assertTrue( update_blog_option( $blog_id, $key2, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( $blog_id, $key2 ) );
- // $this->assertEquals( $value2, get_option( $key2 ) ); // Check get_option().
+ $this->assertSame( $value2, get_blog_option( $blog_id, $key2 ) );
+ // $this->assertSame( $value2, get_option( $key2 ) ); // Check get_option().
$this->assertTrue( delete_blog_option( $blog_id, $key2 ) );
$this->assertFalse( get_blog_option( $blog_id, $key2 ) );
// $this->assertFalse( get_option( $key2 ) ); // Check get_option().
@@ -184,7 +184,7 @@ if ( is_multisite() ) :
*/
function test_sanitize_network_option_illegal_names( $option_value, $sanitized_option_value ) {
update_site_option( 'illegal_names', $option_value );
- $this->assertEquals( $sanitized_option_value, get_site_option( 'illegal_names' ) );
+ $this->assertSame( $sanitized_option_value, get_site_option( 'illegal_names' ) );
}
function data_illegal_names() {
@@ -203,7 +203,7 @@ if ( is_multisite() ) :
*/
function test_sanitize_network_option_limited_email_domains( $option_value, $sanitized_option_value ) {
update_site_option( 'limited_email_domains', $option_value );
- $this->assertEquals( $sanitized_option_value, get_site_option( 'limited_email_domains' ) );
+ $this->assertSame( $sanitized_option_value, get_site_option( 'limited_email_domains' ) );
}
/**
@@ -214,7 +214,7 @@ if ( is_multisite() ) :
*/
function test_sanitize_network_option_banned_email_domains( $option_value, $sanitized_option_value ) {
update_site_option( 'banned_email_domains', $option_value );
- $this->assertEquals( $sanitized_option_value, get_site_option( 'banned_email_domains' ) );
+ $this->assertSame( $sanitized_option_value, get_site_option( 'banned_email_domains' ) );
}
function data_email_domains() {
diff --git a/tests/phpunit/tests/option/networkOption.php b/tests/phpunit/tests/option/networkOption.php
index 244ea43898..a6cd1b6690 100644
--- a/tests/phpunit/tests/option/networkOption.php
+++ b/tests/phpunit/tests/option/networkOption.php
@@ -33,7 +33,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
$value = __FUNCTION__;
add_network_option( $id, $option, $value );
- $this->assertEquals( $value, get_network_option( $id, $option, false ) );
+ $this->assertSame( $value, get_network_option( $id, $option, false ) );
}
/**
@@ -47,7 +47,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
add_site_option( $option, $value );
add_network_option( $id, $option, $value );
delete_site_option( $option );
- $this->assertEquals( $value, get_network_option( $id, $option, false ) );
+ $this->assertSame( $value, get_network_option( $id, $option, false ) );
}
/**
@@ -88,7 +88,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
$option = rand_str();
$value = rand_str();
- $this->assertEquals( $expected_response, add_network_option( $network_id, $option, $value ) );
+ $this->assertSame( $expected_response, add_network_option( $network_id, $option, $value ) );
}
/**
@@ -100,7 +100,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
function test_get_network_option_network_id_parameter( $network_id, $expected_response ) {
$option = rand_str();
- $this->assertEquals( $expected_response, get_network_option( $network_id, $option, true ) );
+ $this->assertSame( $expected_response, get_network_option( $network_id, $option, true ) );
}
function data_network_id_parameter() {
@@ -203,6 +203,6 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
$this->assertFalse( update_network_option( null, 'array_w_object', $array_w_object_2 ) );
// Check that no new database queries were performed.
- $this->assertEquals( $num_queries_pre_update, get_num_queries() );
+ $this->assertSame( $num_queries_pre_update, get_num_queries() );
}
}
diff --git a/tests/phpunit/tests/option/option.php b/tests/phpunit/tests/option/option.php
index 0d2f36595d..f461a7db98 100644
--- a/tests/phpunit/tests/option/option.php
+++ b/tests/phpunit/tests/option/option.php
@@ -17,19 +17,19 @@ class Tests_Option_Option extends WP_UnitTestCase {
$this->assertFalse( get_option( 'doesnotexist' ) );
$this->assertTrue( add_option( $key, $value ) );
- $this->assertEquals( $value, get_option( $key ) );
+ $this->assertSame( $value, get_option( $key ) );
$this->assertFalse( add_option( $key, $value ) ); // Already exists.
$this->assertFalse( update_option( $key, $value ) ); // Value is the same.
$this->assertTrue( update_option( $key, $value2 ) );
- $this->assertEquals( $value2, get_option( $key ) );
+ $this->assertSame( $value2, get_option( $key ) );
$this->assertFalse( add_option( $key, $value ) );
- $this->assertEquals( $value2, get_option( $key ) );
+ $this->assertSame( $value2, get_option( $key ) );
$this->assertTrue( delete_option( $key ) );
$this->assertFalse( get_option( $key ) );
$this->assertFalse( delete_option( $key ) );
$this->assertTrue( update_option( $key2, $value2 ) );
- $this->assertEquals( $value2, get_option( $key2 ) );
+ $this->assertSame( $value2, get_option( $key2 ) );
$this->assertTrue( delete_option( $key2 ) );
$this->assertFalse( get_option( $key2 ) );
}
@@ -41,17 +41,17 @@ class Tests_Option_Option extends WP_UnitTestCase {
// Default filter overrides $default arg.
add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
- $this->assertEquals( 'foo', get_option( 'doesnotexist', 'bar' ) );
+ $this->assertSame( 'foo', get_option( 'doesnotexist', 'bar' ) );
// Remove the filter and the $default arg is honored.
remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
- $this->assertEquals( 'bar', get_option( 'doesnotexist', 'bar' ) );
+ $this->assertSame( 'bar', get_option( 'doesnotexist', 'bar' ) );
// Once the option exists, the $default arg and the default filter are ignored.
add_option( 'doesnotexist', $value );
- $this->assertEquals( $value, get_option( 'doesnotexist', 'foo' ) );
+ $this->assertSame( $value, get_option( 'doesnotexist', 'foo' ) );
add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
- $this->assertEquals( $value, get_option( 'doesnotexist', 'foo' ) );
+ $this->assertSame( $value, get_option( 'doesnotexist', 'foo' ) );
remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
// Cleanup.
@@ -79,7 +79,7 @@ class Tests_Option_Option extends WP_UnitTestCase {
);
$this->assertTrue( add_option( $key, $value ) );
- $this->assertEquals( $value, get_option( $key ) );
+ $this->assertSame( $value, get_option( $key ) );
$value = (object) $value;
$this->assertTrue( update_option( $key, $value ) );
@@ -138,6 +138,6 @@ class Tests_Option_Option extends WP_UnitTestCase {
$this->assertTrue( $added );
$actual = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s LIMIT 1", $name ) );
- $this->assertEquals( $expected, $actual->autoload );
+ $this->assertSame( $expected, $actual->autoload );
}
}
diff --git a/tests/phpunit/tests/option/registration.php b/tests/phpunit/tests/option/registration.php
index 8e6dd64b41..d60acb9ef1 100644
--- a/tests/phpunit/tests/option/registration.php
+++ b/tests/phpunit/tests/option/registration.php
@@ -11,19 +11,19 @@ class Tests_Option_Registration extends WP_UnitTestCase {
$this->assertArrayHasKey( 'test_option', $registered );
$args = $registered['test_option'];
- $this->assertEquals( 'test_group', $args['group'] );
+ $this->assertSame( 'test_group', $args['group'] );
// Check defaults.
- $this->assertEquals( 'string', $args['type'] );
- $this->assertEquals( false, $args['show_in_rest'] );
- $this->assertEquals( '', $args['description'] );
+ $this->assertSame( 'string', $args['type'] );
+ $this->assertFalse( $args['show_in_rest'] );
+ $this->assertSame( '', $args['description'] );
}
public function test_register_with_callback() {
register_setting( 'test_group', 'test_option', array( $this, 'filter_registered_setting' ) );
$filtered = apply_filters( 'sanitize_option_test_option', 'smart', 'test_option', 'smart' );
- $this->assertEquals( 'S-M-R-T', $filtered );
+ $this->assertSame( 'S-M-R-T', $filtered );
}
public function test_register_with_array() {
@@ -36,7 +36,7 @@ class Tests_Option_Registration extends WP_UnitTestCase {
);
$filtered = apply_filters( 'sanitize_option_test_option', 'smart', 'test_option', 'smart' );
- $this->assertEquals( 'S-M-R-T', $filtered );
+ $this->assertSame( 'S-M-R-T', $filtered );
}
public function filter_registered_setting() {
@@ -55,7 +55,7 @@ class Tests_Option_Registration extends WP_UnitTestCase {
)
);
- $this->assertEquals( 'Got that Viper with them rally stripes', get_option( 'test_default' ) );
+ $this->assertSame( 'Got that Viper with them rally stripes', get_option( 'test_default' ) );
}
/**
@@ -72,7 +72,7 @@ class Tests_Option_Registration extends WP_UnitTestCase {
// This set of tests/references (and a previous version) are in support of Viper007Bond.
// His Viper doesn't have rally stripes, but for the sake of the Big Tymers, we'll go with it.
- $this->assertEquals( 'We the #1 Stunnas', get_option( 'test_default', 'We the #1 Stunnas' ) );
+ $this->assertSame( 'We the #1 Stunnas', get_option( 'test_default', 'We the #1 Stunnas' ) );
}
/**
@@ -88,7 +88,7 @@ class Tests_Option_Registration extends WP_UnitTestCase {
);
wp_cache_delete( 'notoptions', 'options' );
$this->assertTrue( add_option( 'test_default', 'hello' ) );
- $this->assertEquals( 'hello', get_option( 'test_default' ) );
+ $this->assertSame( 'hello', get_option( 'test_default' ) );
}
/**
diff --git a/tests/phpunit/tests/option/sanitize-option.php b/tests/phpunit/tests/option/sanitize-option.php
index 0a6ec865bb..3a1c22215d 100644
--- a/tests/phpunit/tests/option/sanitize-option.php
+++ b/tests/phpunit/tests/option/sanitize-option.php
@@ -138,7 +138,7 @@ class Tests_Sanitize_Option extends WP_UnitTestCase {
$this->assertEmpty( $errors );
} else {
$this->assertNotEmpty( $errors );
- $this->assertEquals( 'invalid_permalink_structure', $errors[0]['code'] );
+ $this->assertSame( 'invalid_permalink_structure', $errors[0]['code'] );
}
$this->assertEquals( $expected, $actual );
diff --git a/tests/phpunit/tests/option/siteOption.php b/tests/phpunit/tests/option/siteOption.php
index 67065019b8..12d25f622b 100644
--- a/tests/phpunit/tests/option/siteOption.php
+++ b/tests/phpunit/tests/option/siteOption.php
@@ -24,7 +24,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
- $this->assertEquals( $value, get_site_option( $key ) );
+ $this->assertSame( $value, get_site_option( $key ) );
}
function test_get_site_option_returns_updated_value() {
@@ -33,32 +33,32 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
$new_value = __FUNCTION__ . '_2';
add_site_option( $key, $value );
update_site_option( $key, $new_value );
- $this->assertEquals( $new_value, get_site_option( $key ) );
+ $this->assertSame( $new_value, get_site_option( $key ) );
}
function test_get_site_option_does_not_exist_returns_filtered_default_with_no_default_provided() {
add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
$site_option = get_site_option( 'doesnotexist' );
remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
- $this->assertEquals( 'foo', $site_option );
+ $this->assertSame( 'foo', $site_option );
}
function test_get_site_option_does_not_exist_returns_filtered_default_with_default_provided() {
add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
$site_option = get_site_option( 'doesnotexist', 'bar' );
remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
- $this->assertEquals( 'foo', $site_option );
+ $this->assertSame( 'foo', $site_option );
}
function test_get_site_option_does_not_exist_returns_provided_default() {
- $this->assertEquals( 'bar', get_site_option( 'doesnotexist', 'bar' ) );
+ $this->assertSame( 'bar', get_site_option( 'doesnotexist', 'bar' ) );
}
function test_get_site_option_exists_does_not_return_provided_default() {
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
- $this->assertEquals( $value, get_site_option( $key, 'foo' ) );
+ $this->assertSame( $value, get_site_option( $key, 'foo' ) );
}
function test_get_site_option_exists_does_not_return_filtered_default() {
@@ -68,7 +68,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
add_filter( 'default_site_option_' . $key, array( $this, '__return_foo' ) );
$site_option = get_site_option( $key );
remove_filter( 'default_site_option_' . $key, array( $this, '__return_foo' ) );
- $this->assertEquals( $value, $site_option );
+ $this->assertSame( $value, $site_option );
}
function test_add_site_option_returns_true_for_new_option() {
@@ -121,7 +121,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
'bar' => true,
);
add_site_option( $key, $value );
- $this->assertEquals( $value, get_site_option( $key ) );
+ $this->assertSame( $value, get_site_option( $key ) );
}
function test_site_option_add_and_get_serialized_object() {
@@ -157,7 +157,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
$option = __FUNCTION__;
$default = 'a default';
- $this->assertEquals( get_site_option( $option, $default ), $default );
+ $this->assertSame( get_site_option( $option, $default ), $default );
$this->assertFalse( get_site_option( $option ) );
}
}
diff --git a/tests/phpunit/tests/option/siteTransient.php b/tests/phpunit/tests/option/siteTransient.php
index f9680e6ca3..7050b2cd90 100644
--- a/tests/phpunit/tests/option/siteTransient.php
+++ b/tests/phpunit/tests/option/siteTransient.php
@@ -20,10 +20,10 @@ class Tests_Option_SiteTransient extends WP_UnitTestCase {
$this->assertFalse( get_site_transient( 'doesnotexist' ) );
$this->assertTrue( set_site_transient( $key, $value ) );
- $this->assertEquals( $value, get_site_transient( $key ) );
+ $this->assertSame( $value, get_site_transient( $key ) );
$this->assertFalse( set_site_transient( $key, $value ) );
$this->assertTrue( set_site_transient( $key, $value2 ) );
- $this->assertEquals( $value2, get_site_transient( $key ) );
+ $this->assertSame( $value2, get_site_transient( $key ) );
$this->assertTrue( delete_site_transient( $key ) );
$this->assertFalse( get_site_transient( $key ) );
$this->assertFalse( delete_site_transient( $key ) );
@@ -37,7 +37,7 @@ class Tests_Option_SiteTransient extends WP_UnitTestCase {
);
$this->assertTrue( set_site_transient( $key, $value ) );
- $this->assertEquals( $value, get_site_transient( $key ) );
+ $this->assertSame( $value, get_site_transient( $key ) );
$value = (object) $value;
$this->assertTrue( set_site_transient( $key, $value ) );
diff --git a/tests/phpunit/tests/option/slashes.php b/tests/phpunit/tests/option/slashes.php
index 5a7c9f6a5f..20220e5d58 100644
--- a/tests/phpunit/tests/option/slashes.php
+++ b/tests/phpunit/tests/option/slashes.php
@@ -28,10 +28,10 @@ class Tests_Option_Slashes extends WP_UnitTestCase {
add_option( 'slash_test_3', $this->slash_3 );
add_option( 'slash_test_4', $this->slash_4 );
- $this->assertEquals( $this->slash_1, get_option( 'slash_test_1' ) );
- $this->assertEquals( $this->slash_2, get_option( 'slash_test_2' ) );
- $this->assertEquals( $this->slash_3, get_option( 'slash_test_3' ) );
- $this->assertEquals( $this->slash_4, get_option( 'slash_test_4' ) );
+ $this->assertSame( $this->slash_1, get_option( 'slash_test_1' ) );
+ $this->assertSame( $this->slash_2, get_option( 'slash_test_2' ) );
+ $this->assertSame( $this->slash_3, get_option( 'slash_test_3' ) );
+ $this->assertSame( $this->slash_4, get_option( 'slash_test_4' ) );
}
/**
@@ -41,15 +41,15 @@ class Tests_Option_Slashes extends WP_UnitTestCase {
add_option( 'slash_test_5', 'foo' );
update_option( 'slash_test_5', $this->slash_1 );
- $this->assertEquals( $this->slash_1, get_option( 'slash_test_5' ) );
+ $this->assertSame( $this->slash_1, get_option( 'slash_test_5' ) );
update_option( 'slash_test_5', $this->slash_2 );
- $this->assertEquals( $this->slash_2, get_option( 'slash_test_5' ) );
+ $this->assertSame( $this->slash_2, get_option( 'slash_test_5' ) );
update_option( 'slash_test_5', $this->slash_3 );
- $this->assertEquals( $this->slash_3, get_option( 'slash_test_5' ) );
+ $this->assertSame( $this->slash_3, get_option( 'slash_test_5' ) );
update_option( 'slash_test_5', $this->slash_4 );
- $this->assertEquals( $this->slash_4, get_option( 'slash_test_5' ) );
+ $this->assertSame( $this->slash_4, get_option( 'slash_test_5' ) );
}
}
diff --git a/tests/phpunit/tests/option/themeMods.php b/tests/phpunit/tests/option/themeMods.php
index 5c39de6b9e..53683f72a0 100644
--- a/tests/phpunit/tests/option/themeMods.php
+++ b/tests/phpunit/tests/option/themeMods.php
@@ -6,30 +6,30 @@
class Tests_Option_Theme_Mods extends WP_UnitTestCase {
function test_theme_mod_default() {
- $this->assertEquals( '', get_theme_mod( 'non_existent' ) );
+ $this->assertFalse( get_theme_mod( 'non_existent' ) );
}
function test_theme_mod_defined_default() {
- $this->assertEquals( 'default', get_theme_mod( 'non_existent', 'default' ) );
+ $this->assertSame( 'default', get_theme_mod( 'non_existent', 'default' ) );
}
function test_theme_mod_set() {
$expected = 'value';
set_theme_mod( 'test_name', $expected );
- $this->assertEquals( $expected, get_theme_mod( 'test_name' ) );
+ $this->assertSame( $expected, get_theme_mod( 'test_name' ) );
}
function test_theme_mod_update() {
set_theme_mod( 'test_update', 'first_value' );
$expected = 'updated_value';
set_theme_mod( 'test_update', $expected );
- $this->assertEquals( $expected, get_theme_mod( 'test_update' ) );
+ $this->assertSame( $expected, get_theme_mod( 'test_update' ) );
}
function test_theme_mod_remove() {
set_theme_mod( 'test_remove', 'value' );
remove_theme_mod( 'test_remove' );
- $this->assertEquals( '', get_theme_mod( 'test_remove' ) );
+ $this->assertFalse( get_theme_mod( 'test_remove' ) );
}
/**
@@ -38,7 +38,7 @@ class Tests_Option_Theme_Mods extends WP_UnitTestCase {
* @dataProvider data_theme_mod_default_value_with_percent_symbols
*/
function test_theme_mod_default_value_with_percent_symbols( $default, $expected ) {
- $this->assertEquals( $expected, get_theme_mod( 'test_name', $default ) );
+ $this->assertSame( $expected, get_theme_mod( 'test_name', $default ) );
}
function data_theme_mod_default_value_with_percent_symbols() {
diff --git a/tests/phpunit/tests/option/transient.php b/tests/phpunit/tests/option/transient.php
index 90432a5e69..5f3116a1f4 100644
--- a/tests/phpunit/tests/option/transient.php
+++ b/tests/phpunit/tests/option/transient.php
@@ -20,10 +20,10 @@ class Tests_Option_Transient extends WP_UnitTestCase {
$this->assertFalse( get_transient( 'doesnotexist' ) );
$this->assertTrue( set_transient( $key, $value ) );
- $this->assertEquals( $value, get_transient( $key ) );
+ $this->assertSame( $value, get_transient( $key ) );
$this->assertFalse( set_transient( $key, $value ) );
$this->assertTrue( set_transient( $key, $value2 ) );
- $this->assertEquals( $value2, get_transient( $key ) );
+ $this->assertSame( $value2, get_transient( $key ) );
$this->assertTrue( delete_transient( $key ) );
$this->assertFalse( get_transient( $key ) );
$this->assertFalse( delete_transient( $key ) );
@@ -37,7 +37,7 @@ class Tests_Option_Transient extends WP_UnitTestCase {
);
$this->assertTrue( set_transient( $key, $value ) );
- $this->assertEquals( $value, get_transient( $key ) );
+ $this->assertSame( $value, get_transient( $key ) );
$value = (object) $value;
$this->assertTrue( set_transient( $key, $value ) );
@@ -74,7 +74,7 @@ class Tests_Option_Transient extends WP_UnitTestCase {
$value = rand_str();
$value2 = rand_str();
$this->assertTrue( set_transient( $key, $value ) );
- $this->assertEquals( $value, get_transient( $key ) );
+ $this->assertSame( $value, get_transient( $key ) );
$this->assertFalse( get_option( '_transient_timeout_' . $key ) );
@@ -96,7 +96,7 @@ class Tests_Option_Transient extends WP_UnitTestCase {
// Create a bogus a transient.
$key = 'test_transient';
set_transient( $key, 'test', 60 * 10 );
- $this->assertEquals( 'test', get_transient( $key ) );
+ $this->assertSame( 'test', get_transient( $key ) );
// Useful variables for tracking.
$transient_timeout = '_transient_timeout_' . $key;
@@ -114,7 +114,7 @@ class Tests_Option_Transient extends WP_UnitTestCase {
get_transient( $key );
// Make sure 'delete_option' was not called for both the transient and the timeout.
- $this->assertEquals( 0, $a->get_call_count() );
+ $this->assertSame( 0, $a->get_call_count() );
}
/**
@@ -124,7 +124,7 @@ class Tests_Option_Transient extends WP_UnitTestCase {
// Create a transient.
$key = 'test_transient';
set_transient( $key, 'test', 60 * 10 );
- $this->assertEquals( 'test', get_transient( $key ) );
+ $this->assertSame( 'test', get_transient( $key ) );
// Make sure the timeout option returns false.
$timeout = '_transient_timeout_' . $key;
@@ -141,7 +141,7 @@ class Tests_Option_Transient extends WP_UnitTestCase {
get_transient( $key );
// Make sure 'delete_option' was called for both the transient and the timeout.
- $this->assertEquals( 2, $a->get_call_count() );
+ $this->assertSame( 2, $a->get_call_count() );
$expected = array(
array(
@@ -155,6 +155,6 @@ class Tests_Option_Transient extends WP_UnitTestCase {
'args' => array( $timeout ),
),
);
- $this->assertEquals( $expected, $a->get_events() );
+ $this->assertSame( $expected, $a->get_events() );
}
}
diff --git a/tests/phpunit/tests/option/updateOption.php b/tests/phpunit/tests/option/updateOption.php
index 77a884fc41..db2aab24a2 100644
--- a/tests/phpunit/tests/option/updateOption.php
+++ b/tests/phpunit/tests/option/updateOption.php
@@ -32,8 +32,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$value = get_option( 'test_update_option_default' );
$after = $wpdb->num_queries;
- $this->assertEquals( $before, $after );
- $this->assertEquals( $value, 'value' );
+ $this->assertSame( $before, $after );
+ $this->assertSame( $value, 'value' );
}
/**
@@ -52,8 +52,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$value = get_option( 'test_update_option_default' );
$after = $wpdb->num_queries;
- $this->assertEquals( $before, $after );
- $this->assertEquals( $value, 'value' );
+ $this->assertSame( $before, $after );
+ $this->assertSame( $value, 'value' );
}
/**
@@ -73,8 +73,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$after = $wpdb->num_queries;
// Database has been hit.
- $this->assertEquals( $before + 1, $after );
- $this->assertEquals( $value, 'value' );
+ $this->assertSame( $before + 1, $after );
+ $this->assertSame( $value, 'value' );
}
/**
@@ -94,8 +94,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$after = $wpdb->num_queries;
// Database has been hit.
- $this->assertEquals( $before + 1, $after );
- $this->assertEquals( $value, 'value' );
+ $this->assertSame( $before + 1, $after );
+ $this->assertSame( $value, 'value' );
}
/**
@@ -115,8 +115,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$before = $wpdb->num_queries;
$value = get_option( 'foo' );
- $this->assertEquals( $before, $wpdb->num_queries );
- $this->assertEquals( $value, 'bar2' );
+ $this->assertSame( $before, $wpdb->num_queries );
+ $this->assertSame( $value, 'bar2' );
}
/**
@@ -137,8 +137,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$value = get_option( 'foo' );
// 'foo' should still be autoload=yes, so we should see no additional querios.
- $this->assertEquals( $before, $wpdb->num_queries );
- $this->assertEquals( $value, 'bar' );
+ $this->assertSame( $before, $wpdb->num_queries );
+ $this->assertSame( $value, 'bar' );
}
/**
@@ -161,8 +161,8 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$value = get_option( 'foo' );
// 'foo' should still be autoload=yes, so we should see no additional querios.
- $this->assertEquals( $before, $wpdb->num_queries );
- $this->assertEquals( $value, 'bar2' );
+ $this->assertSame( $before, $wpdb->num_queries );
+ $this->assertSame( $value, 'bar2' );
}
/**
@@ -187,7 +187,7 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
$this->assertFalse( update_option( 'array_w_object', $array_w_object ) );
// Check that no new database queries were performed.
- $this->assertEquals( $num_queries_pre_update, get_num_queries() );
+ $this->assertSame( $num_queries_pre_update, get_num_queries() );
}
/**
diff --git a/tests/phpunit/tests/option/userSettings.php b/tests/phpunit/tests/option/userSettings.php
index 7e979de6e9..e09c226355 100644
--- a/tests/phpunit/tests/option/userSettings.php
+++ b/tests/phpunit/tests/option/userSettings.php
@@ -27,7 +27,7 @@ class Tests_User_Settings extends WP_UnitTestCase {
$this->set_user_setting( 'foo', 'bar' );
- $this->assertEquals( 'bar', get_user_setting( 'foo' ) );
+ $this->assertSame( 'bar', get_user_setting( 'foo' ) );
}
function test_set_user_setting_dashes() {
@@ -37,7 +37,7 @@ class Tests_User_Settings extends WP_UnitTestCase {
$this->set_user_setting( 'foo', 'foo-bar-baz' );
- $this->assertEquals( 'foo-bar-baz', get_user_setting( 'foo' ) );
+ $this->assertSame( 'foo-bar-baz', get_user_setting( 'foo' ) );
}
function test_set_user_setting_strip_asterisks() {
@@ -47,7 +47,7 @@ class Tests_User_Settings extends WP_UnitTestCase {
$this->set_user_setting( 'foo', 'foo*bar*baz' );
- $this->assertEquals( 'foobarbaz', get_user_setting( 'foo' ) );
+ $this->assertSame( 'foobarbaz', get_user_setting( 'foo' ) );
}
// set_user_setting() bails if `headers_sent()` is true.
diff --git a/tests/phpunit/tests/option/wpLoadAllOptions.php b/tests/phpunit/tests/option/wpLoadAllOptions.php
index 5088f10b9a..76c23d29e0 100644
--- a/tests/phpunit/tests/option/wpLoadAllOptions.php
+++ b/tests/phpunit/tests/option/wpLoadAllOptions.php
@@ -33,7 +33,7 @@ class Tests_Option_WP_Load_Alloptions extends WP_UnitTestCase {
$after = $wpdb->num_queries;
// Database has not been hit.
- $this->assertEquals( $before, $after );
+ $this->assertSame( $before, $after );
}
/**
@@ -50,7 +50,7 @@ class Tests_Option_WP_Load_Alloptions extends WP_UnitTestCase {
$after = $wpdb->num_queries;
// Database has been hit.
- $this->assertEquals( $before + 1, $after );
+ $this->assertSame( $before + 1, $after );
}
/**
@@ -76,7 +76,7 @@ class Tests_Option_WP_Load_Alloptions extends WP_UnitTestCase {
wp_installing( $temp );
// Filter was called.
- $this->assertEquals( $this->alloptions, $all_options );
+ $this->assertSame( $this->alloptions, $all_options );
}
/**
diff --git a/tests/phpunit/tests/pomo/mo.php b/tests/phpunit/tests/pomo/mo.php
index a3990198dd..5dd9956f9f 100644
--- a/tests/phpunit/tests/pomo/mo.php
+++ b/tests/phpunit/tests/pomo/mo.php
@@ -8,48 +8,48 @@ class Tests_POMO_MO extends WP_UnitTestCase {
function test_mo_simple() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/simple.mo' );
- $this->assertEquals(
+ $this->assertSame(
array(
'Project-Id-Version' => 'WordPress 2.6-bleeding',
'Report-Msgid-Bugs-To' => 'wp-polyglots@lists.automattic.com',
),
$mo->headers
);
- $this->assertEquals( 2, count( $mo->entries ) );
- $this->assertEquals( array( 'dyado' ), $mo->entries['baba']->translations );
- $this->assertEquals( array( 'yes' ), $mo->entries["kuku\nruku"]->translations );
+ $this->assertSame( 2, count( $mo->entries ) );
+ $this->assertSame( array( 'dyado' ), $mo->entries['baba']->translations );
+ $this->assertSame( array( 'yes' ), $mo->entries["kuku\nruku"]->translations );
}
function test_mo_plural() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/plural.mo' );
- $this->assertEquals( 1, count( $mo->entries ) );
- $this->assertEquals( array( 'oney dragoney', 'twoey dragoney', 'manyey dragoney', 'manyeyey dragoney', 'manyeyeyey dragoney' ), $mo->entries['one dragon']->translations );
+ $this->assertSame( 1, count( $mo->entries ) );
+ $this->assertSame( array( 'oney dragoney', 'twoey dragoney', 'manyey dragoney', 'manyeyey dragoney', 'manyeyeyey dragoney' ), $mo->entries['one dragon']->translations );
- $this->assertEquals( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
- $this->assertEquals( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 2 ) );
- $this->assertEquals( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
+ $this->assertSame( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
+ $this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 2 ) );
+ $this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
$mo->set_header( 'Plural-Forms', 'nplurals=5; plural=0' );
- $this->assertEquals( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
- $this->assertEquals( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 2 ) );
- $this->assertEquals( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
+ $this->assertSame( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
+ $this->assertSame( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 2 ) );
+ $this->assertSame( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
$mo->set_header( 'Plural-Forms', 'nplurals=5; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;' );
- $this->assertEquals( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
- $this->assertEquals( 'manyey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 11 ) );
- $this->assertEquals( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 3 ) );
+ $this->assertSame( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
+ $this->assertSame( 'manyey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 11 ) );
+ $this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 3 ) );
$mo->set_header( 'Plural-Forms', 'nplurals=2; plural=n !=1;' );
- $this->assertEquals( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
- $this->assertEquals( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 2 ) );
- $this->assertEquals( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
+ $this->assertSame( 'oney dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 1 ) );
+ $this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', 2 ) );
+ $this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
}
function test_mo_context() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/context.mo' );
- $this->assertEquals( 2, count( $mo->entries ) );
+ $this->assertSame( 2, count( $mo->entries ) );
$plural_entry = new Translation_Entry(
array(
'singular' => 'one dragon',
@@ -59,7 +59,7 @@ class Tests_POMO_MO extends WP_UnitTestCase {
)
);
$this->assertEquals( $plural_entry, $mo->entries[ $plural_entry->key() ] );
- $this->assertEquals( 'dragonland', $mo->entries[ $plural_entry->key() ]->context );
+ $this->assertSame( 'dragonland', $mo->entries[ $plural_entry->key() ]->context );
$single_entry = new Translation_Entry(
array(
@@ -69,7 +69,7 @@ class Tests_POMO_MO extends WP_UnitTestCase {
)
);
$this->assertEquals( $single_entry, $mo->entries[ $single_entry->key() ] );
- $this->assertEquals( 'not so dragon', $mo->entries[ $single_entry->key() ]->context );
+ $this->assertSame( 'not so dragon', $mo->entries[ $single_entry->key() ]->context );
}
@@ -81,8 +81,8 @@ class Tests_POMO_MO extends WP_UnitTestCase {
$guest->add_entry( new Translation_Entry( array( 'singular' => 'green' ) ) );
$guest->add_entry( new Translation_Entry( array( 'singular' => 'red' ) ) );
$host->merge_with( $guest );
- $this->assertEquals( 3, count( $host->entries ) );
- $this->assertEquals( array(), array_diff( array( 'pink', 'green', 'red' ), array_keys( $host->entries ) ) );
+ $this->assertSame( 3, count( $host->entries ) );
+ $this->assertSame( array(), array_diff( array( 'pink', 'green', 'red' ), array_keys( $host->entries ) ) );
}
function test_export_mo_file() {
@@ -137,7 +137,7 @@ class Tests_POMO_MO extends WP_UnitTestCase {
$again = new MO();
$again->import_from_file( $temp_fn );
- $this->assertEquals( count( $entries ), count( $again->entries ) );
+ $this->assertSame( count( $entries ), count( $again->entries ) );
foreach ( $entries as $entry ) {
$this->assertEquals( $entry, $again->entries[ $entry->key() ] );
}
@@ -159,15 +159,15 @@ class Tests_POMO_MO extends WP_UnitTestCase {
$again = new MO();
$again->import_from_file( $temp_fn );
- $this->assertEquals( 0, count( $again->entries ) );
+ $this->assertSame( 0, count( $again->entries ) );
}
function test_nplurals_with_backslashn() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/bad_nplurals.mo' );
- $this->assertEquals( '%d foro', $mo->translate_plural( '%d forum', '%d forums', 1 ) );
- $this->assertEquals( '%d foros', $mo->translate_plural( '%d forum', '%d forums', 2 ) );
- $this->assertEquals( '%d foros', $mo->translate_plural( '%d forum', '%d forums', -1 ) );
+ $this->assertSame( '%d foro', $mo->translate_plural( '%d forum', '%d forums', 1 ) );
+ $this->assertSame( '%d foros', $mo->translate_plural( '%d forum', '%d forums', 2 ) );
+ $this->assertSame( '%d foros', $mo->translate_plural( '%d forum', '%d forums', -1 ) );
}
function disabled_test_performance() {
@@ -184,11 +184,11 @@ class Tests_POMO_MO extends WP_UnitTestCase {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/overload.mo' );
- $this->assertEquals( array( 'Табло' ), $mo->entries['Dashboard']->translations );
+ $this->assertSame( array( 'Табло' ), $mo->entries['Dashboard']->translations );
}
function test_load_pot_file() {
$mo = new MO();
- $this->assertEquals( false, $mo->import_from_file( DIR_TESTDATA . '/pomo/mo.pot' ) );
+ $this->assertFalse( $mo->import_from_file( DIR_TESTDATA . '/pomo/mo.pot' ) );
}
}
diff --git a/tests/phpunit/tests/pomo/noopTranslations.php b/tests/phpunit/tests/pomo/noopTranslations.php
index 1e1a60c4c1..13ff9e6187 100644
--- a/tests/phpunit/tests/pomo/noopTranslations.php
+++ b/tests/phpunit/tests/pomo/noopTranslations.php
@@ -18,33 +18,33 @@ class Tests_POMO_NOOPTranslations extends WP_UnitTestCase {
}
function test_get_header() {
- $this->assertEquals( false, $this->noop->get_header( 'Content-Type' ) );
+ $this->assertFalse( $this->noop->get_header( 'Content-Type' ) );
}
function test_add_entry() {
$this->noop->add_entry( $this->entry );
- $this->assertEquals( array(), $this->noop->entries );
+ $this->assertSame( array(), $this->noop->entries );
}
function test_set_header() {
$this->noop->set_header( 'header', 'value' );
- $this->assertEquals( array(), $this->noop->headers );
+ $this->assertSame( array(), $this->noop->headers );
}
function test_translate_entry() {
$this->noop->add_entry( $this->entry );
- $this->assertEquals( false, $this->noop->translate_entry( $this->entry ) );
+ $this->assertFalse( $this->noop->translate_entry( $this->entry ) );
}
function test_translate() {
$this->noop->add_entry( $this->entry );
- $this->assertEquals( 'baba', $this->noop->translate( 'baba' ) );
+ $this->assertSame( 'baba', $this->noop->translate( 'baba' ) );
}
function test_plural() {
$this->noop->add_entry( $this->plural_entry );
- $this->assertEquals( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) );
- $this->assertEquals( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 11 ) );
- $this->assertEquals( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 0 ) );
+ $this->assertSame( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) );
+ $this->assertSame( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 11 ) );
+ $this->assertSame( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 0 ) );
}
}
diff --git a/tests/phpunit/tests/pomo/pluralForms.php b/tests/phpunit/tests/pomo/pluralForms.php
index 2d53c29c56..3c84321652 100644
--- a/tests/phpunit/tests/pomo/pluralForms.php
+++ b/tests/phpunit/tests/pomo/pluralForms.php
@@ -213,7 +213,7 @@ class PluralFormsTest extends WP_UnitTestCase {
$plural_forms->get( 1 );
}
} catch ( Exception $e ) {
- $this->assertEquals( $expected_exception, $e->getMessage() );
+ $this->assertSame( $expected_exception, $e->getMessage() );
return;
}
@@ -236,6 +236,6 @@ class PluralFormsTest extends WP_UnitTestCase {
$first = $mock->get( 2 );
$second = $mock->get( 2 );
- $this->assertEquals( $first, $second );
+ $this->assertSame( $first, $second );
}
}
diff --git a/tests/phpunit/tests/pomo/po.php b/tests/phpunit/tests/pomo/po.php
index 81cc058932..028c9ece9a 100644
--- a/tests/phpunit/tests/pomo/po.php
+++ b/tests/phpunit/tests/pomo/po.php
@@ -43,45 +43,45 @@ http://wordpress.org/
function test_prepend_each_line() {
$po = new PO();
- $this->assertEquals( 'baba_', $po->prepend_each_line( '', 'baba_' ) );
- $this->assertEquals( 'baba_dyado', $po->prepend_each_line( 'dyado', 'baba_' ) );
- $this->assertEquals( "# baba\n# dyado\n# \n", $po->prepend_each_line( "baba\ndyado\n\n", '# ' ) );
+ $this->assertSame( 'baba_', $po->prepend_each_line( '', 'baba_' ) );
+ $this->assertSame( 'baba_dyado', $po->prepend_each_line( 'dyado', 'baba_' ) );
+ $this->assertSame( "# baba\n# dyado\n# \n", $po->prepend_each_line( "baba\ndyado\n\n", '# ' ) );
}
function test_poify() {
$po = new PO();
// Simple.
- $this->assertEquals( '"baba"', $po->poify( 'baba' ) );
+ $this->assertSame( '"baba"', $po->poify( 'baba' ) );
// Long word.
- $this->assertEquals( $this->po_a90, $po->poify( $this->a90 ) );
+ $this->assertSame( $this->po_a90, $po->poify( $this->a90 ) );
// Tab.
- $this->assertEquals( '"ba\tba"', $po->poify( "ba\tba" ) );
+ $this->assertSame( '"ba\tba"', $po->poify( "ba\tba" ) );
// Do not add leading empty string of one-line string ending on a newline.
- $this->assertEquals( '"\\\\a\\\\n\\n"', $po->poify( "\a\\n\n" ) );
+ $this->assertSame( '"\\\\a\\\\n\\n"', $po->poify( "\a\\n\n" ) );
// Backslash.
- $this->assertEquals( '"ba\\\\ba"', $po->poify( 'ba\\ba' ) );
+ $this->assertSame( '"ba\\\\ba"', $po->poify( 'ba\\ba' ) );
// Random wordpress.pot string.
$src = 'Categories can be selectively converted to tags using the category to tag converter.';
- $this->assertEquals( '"Categories can be selectively converted to tags using the category to tag converter."', $po->poify( $src ) );
+ $this->assertSame( '"Categories can be selectively converted to tags using the category to tag converter."', $po->poify( $src ) );
- $this->assertEqualsIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) );
+ $this->assertSameIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) );
}
function test_unpoify() {
$po = new PO();
- $this->assertEquals( 'baba', $po->unpoify( '"baba"' ) );
- $this->assertEquals( "baba\ngugu", $po->unpoify( '"baba\n"' . "\t\t\t\n" . '"gugu"' ) );
- $this->assertEquals( $this->a90, $po->unpoify( $this->po_a90 ) );
- $this->assertEquals( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) );
+ $this->assertSame( 'baba', $po->unpoify( '"baba"' ) );
+ $this->assertSame( "baba\ngugu", $po->unpoify( '"baba\n"' . "\t\t\t\n" . '"gugu"' ) );
+ $this->assertSame( $this->a90, $po->unpoify( $this->po_a90 ) );
+ $this->assertSame( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) );
// Wordwrapped.
- $this->assertEquals( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) );
- $this->assertEqualsIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) );
+ $this->assertSame( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) );
+ $this->assertSameIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) );
}
function test_export_entry() {
$po = new PO();
$entry = new Translation_Entry( array( 'singular' => 'baba' ) );
- $this->assertEquals( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) );
+ $this->assertSame( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) );
// Plural.
$entry = new Translation_Entry(
array(
@@ -89,7 +89,7 @@ http://wordpress.org/
'plural' => 'babas',
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'msgid "baba"
msgid_plural "babas"
msgstr[0] ""
@@ -102,7 +102,7 @@ msgstr[1] ""',
'translator_comments' => "baba\ndyado",
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'# baba
# dyado
msgid "baba"
@@ -115,7 +115,7 @@ msgstr ""',
'extracted_comments' => 'baba',
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'#. baba
msgid "baba"
msgstr ""',
@@ -128,7 +128,7 @@ msgstr ""',
'references' => range( 1, 29 ),
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'#. baba
#: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#: 29
@@ -142,7 +142,7 @@ msgstr ""',
'translations' => array(),
)
);
- $this->assertEquals( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) );
+ $this->assertSame( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) );
$entry = new Translation_Entry(
array(
@@ -150,7 +150,7 @@ msgstr ""',
'translations' => array( 'куку', 'буку' ),
)
);
- $this->assertEquals( "msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry( $entry ) );
+ $this->assertSame( "msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry( $entry ) );
$entry = new Translation_Entry(
array(
@@ -159,7 +159,7 @@ msgstr ""',
'translations' => array( 'кукубуку' ),
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'msgid "baba"
msgid_plural "babas"
msgstr[0] "кукубуку"',
@@ -173,7 +173,7 @@ msgstr[0] "кукубуку"',
'translations' => array( 'кукубуку', 'кукуруку', 'бабаяга' ),
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'msgid "baba"
msgid_plural "babas"
msgstr[0] "кукубуку"
@@ -191,7 +191,7 @@ msgstr[2] "бабаяга"',
'flags' => array( 'fuzzy', 'php-format' ),
)
);
- $this->assertEqualsIgnoreEOL(
+ $this->assertSameIgnoreEOL(
'#, fuzzy, php-format
msgctxt "ctxt"
msgid "baba"
@@ -209,14 +209,14 @@ msgstr[2] "бабаяга"',
$po = new PO();
$po->add_entry( $entry );
$po->add_entry( $entry2 );
- $this->assertEquals( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export_entries() );
+ $this->assertSame( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export_entries() );
}
function test_export_headers() {
$po = new PO();
$po->set_header( 'Project-Id-Version', 'WordPress 2.6-bleeding' );
$po->set_header( 'POT-Creation-Date', '2008-04-08 18:00+0000' );
- $this->assertEquals( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"", $po->export_headers() );
+ $this->assertSame( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"", $po->export_headers() );
}
function test_export() {
@@ -227,8 +227,8 @@ msgstr[2] "бабаяга"',
$po->set_header( 'POT-Creation-Date', '2008-04-08 18:00+0000' );
$po->add_entry( $entry );
$po->add_entry( $entry2 );
- $this->assertEquals( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export( false ) );
- $this->assertEquals( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"\n\nmsgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export() );
+ $this->assertSame( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export( false ) );
+ $this->assertSame( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"\n\nmsgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export() );
}
@@ -243,19 +243,19 @@ msgstr[2] "бабаяга"',
$temp_fn = $this->temp_filename();
$po->export_to_file( $temp_fn, false );
- $this->assertEquals( $po->export( false ), file_get_contents( $temp_fn ) );
+ $this->assertSame( $po->export( false ), file_get_contents( $temp_fn ) );
$temp_fn2 = $this->temp_filename();
$po->export_to_file( $temp_fn2 );
- $this->assertEquals( $po->export(), file_get_contents( $temp_fn2 ) );
+ $this->assertSame( $po->export(), file_get_contents( $temp_fn2 ) );
}
function test_import_from_file() {
$po = new PO();
$res = $po->import_from_file( DIR_TESTDATA . '/pomo/simple.po' );
- $this->assertEquals( true, $res );
+ $this->assertTrue( $res );
- $this->assertEquals(
+ $this->assertSame(
array(
'Project-Id-Version' => 'WordPress 2.6-bleeding',
'Plural-Forms' => 'nplurals=2; plural=n != 1;',
@@ -317,7 +317,7 @@ msgstr[2] "бабаяга"',
function test_import_from_file_with_windows_line_endings_should_work_as_with_unix_line_endings() {
$po = new PO();
$this->assertTrue( $po->import_from_file( DIR_TESTDATA . '/pomo/windows-line-endings.po' ) );
- $this->assertEquals( 1, count( $po->entries ) );
+ $this->assertSame( 1, count( $po->entries ) );
}
// TODO: Add tests for bad files.
diff --git a/tests/phpunit/tests/pomo/translationEntry.php b/tests/phpunit/tests/pomo/translationEntry.php
index 0f68ba7cc2..60485cd8aa 100644
--- a/tests/phpunit/tests/pomo/translationEntry.php
+++ b/tests/phpunit/tests/pomo/translationEntry.php
@@ -21,12 +21,12 @@ class Tests_POMO_TranslationEntry extends WP_UnitTestCase {
'flags' => 'baba',
)
);
- $this->assertEquals( 'baba', $entry->singular );
- $this->assertEquals( 'babas', $entry->plural );
+ $this->assertSame( 'baba', $entry->singular );
+ $this->assertSame( 'babas', $entry->plural );
$this->assertTrue( $entry->is_plural );
- $this->assertEquals( array( 'баба', 'баби' ), $entry->translations );
- $this->assertEquals( array(), $entry->references );
- $this->assertEquals( array(), $entry->flags );
+ $this->assertSame( array( 'баба', 'баби' ), $entry->translations );
+ $this->assertSame( array(), $entry->references );
+ $this->assertSame( array(), $entry->flags );
}
function test_key() {
@@ -44,7 +44,7 @@ class Tests_POMO_TranslationEntry extends WP_UnitTestCase {
'plural' => 'babas',
)
);
- $this->assertEquals( $entry_baba->key(), $entry_baba_plural->key() );
+ $this->assertSame( $entry_baba->key(), $entry_baba_plural->key() );
$this->assertNotEquals( $entry_baba->key(), $entry_baba_ctxt->key() );
$this->assertNotEquals( $entry_baba_plural->key(), $entry_baba_ctxt->key() );
$this->assertNotEquals( $entry_baba->key(), $entry_dyado->key() );
diff --git a/tests/phpunit/tests/pomo/translations.php b/tests/phpunit/tests/pomo/translations.php
index c9f034b524..daa3f630b2 100644
--- a/tests/phpunit/tests/pomo/translations.php
+++ b/tests/phpunit/tests/pomo/translations.php
@@ -11,14 +11,14 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$empty = new Translation_Entry();
$po = new Translations();
$po->add_entry( $entry );
- $this->assertEquals( array( $entry->key() => $entry ), $po->entries );
+ $this->assertSame( array( $entry->key() => $entry ), $po->entries );
// Add the same entry more than once.
// We do not need to test proper key generation here, see test_key().
$po->add_entry( $entry );
$po->add_entry( $entry );
- $this->assertEquals( array( $entry->key() => $entry ), $po->entries );
+ $this->assertSame( array( $entry->key() => $entry ), $po->entries );
$po->add_entry( $entry2 );
- $this->assertEquals(
+ $this->assertSame(
array(
$entry->key() => $entry,
$entry2->key() => $entry2,
@@ -26,8 +26,8 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$po->entries
);
// Add empty entry.
- $this->assertEquals( false, $po->add_entry( $empty ) );
- $this->assertEquals(
+ $this->assertFalse( $po->add_entry( $empty ) );
+ $this->assertSame(
array(
$entry->key() => $entry,
$entry2->key() => $entry2,
@@ -39,7 +39,7 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$po = new Translations();
$po->add_entry( array( 'singular' => 'baba' ) );
$entries = array_values( $po->entries );
- $this->assertEquals( $entry->key(), $entries[0]->key() );
+ $this->assertSame( $entry->key(), $entries[0]->key() );
}
function test_translate() {
@@ -59,10 +59,10 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$domain = new Translations();
$domain->add_entry( $entry1 );
$domain->add_entry( $entry2 );
- $this->assertEquals( 'babax', $domain->translate( 'baba' ) );
- $this->assertEquals( 'babay', $domain->translate( 'baba', 'x' ) );
- $this->assertEquals( 'baba', $domain->translate( 'baba', 'y' ) );
- $this->assertEquals( 'babaz', $domain->translate( 'babaz' ) );
+ $this->assertSame( 'babax', $domain->translate( 'baba' ) );
+ $this->assertSame( 'babay', $domain->translate( 'baba', 'x' ) );
+ $this->assertSame( 'baba', $domain->translate( 'baba', 'y' ) );
+ $this->assertSame( 'babaz', $domain->translate( 'babaz' ) );
}
function test_translate_plural() {
@@ -91,18 +91,18 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$domain->add_entry( $entry_incomplete );
$domain->add_entry( $entry_toomany );
$domain->add_entry( $entry_2 );
- $this->assertEquals( 'other', $domain->translate_plural( 'other', 'others', 1 ) );
- $this->assertEquals( 'others', $domain->translate_plural( 'other', 'others', 111 ) );
+ $this->assertSame( 'other', $domain->translate_plural( 'other', 'others', 1 ) );
+ $this->assertSame( 'others', $domain->translate_plural( 'other', 'others', 111 ) );
// Too few translations + cont logic.
- $this->assertEquals( 'babas', $domain->translate_plural( 'baba', 'babas', 2 ) );
- $this->assertEquals( 'babas', $domain->translate_plural( 'baba', 'babas', 0 ) );
- $this->assertEquals( 'babas', $domain->translate_plural( 'baba', 'babas', -1 ) );
- $this->assertEquals( 'babas', $domain->translate_plural( 'baba', 'babas', 999 ) );
+ $this->assertSame( 'babas', $domain->translate_plural( 'baba', 'babas', 2 ) );
+ $this->assertSame( 'babas', $domain->translate_plural( 'baba', 'babas', 0 ) );
+ $this->assertSame( 'babas', $domain->translate_plural( 'baba', 'babas', -1 ) );
+ $this->assertSame( 'babas', $domain->translate_plural( 'baba', 'babas', 999 ) );
// Proper.
- $this->assertEquals( 'dyadox', $domain->translate_plural( 'dyado', 'dyados', 1 ) );
- $this->assertEquals( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', 0 ) );
- $this->assertEquals( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', 18881 ) );
- $this->assertEquals( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', -18881 ) );
+ $this->assertSame( 'dyadox', $domain->translate_plural( 'dyado', 'dyados', 1 ) );
+ $this->assertSame( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', 0 ) );
+ $this->assertSame( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', 18881 ) );
+ $this->assertSame( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', -18881 ) );
}
function test_digit_and_merge() {
@@ -122,9 +122,9 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$domain->add_entry( $entry_digit_1 );
$domain->add_entry( $entry_digit_2 );
$dummy_translation = new Translations;
- $this->assertEquals( '1', $domain->translate( '1' ) );
+ $this->assertSame( '1', $domain->translate( '1' ) );
$domain->merge_with( $dummy_translation );
- $this->assertEquals( '1', $domain->translate( '1' ) );
+ $this->assertSame( '1', $domain->translate( '1' ) );
}
}
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 3b5af7bad4..f70304ba98 100644
--- a/tests/phpunit/tests/post.php
+++ b/tests/phpunit/tests/post.php
@@ -85,25 +85,25 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure it matches.
$out = get_post( $id );
- $this->assertEquals( $post['post_content'], $out->post_content );
- $this->assertEquals( $post['post_title'], $out->post_title );
- $this->assertEquals( $post['post_status'], $out->post_status );
+ $this->assertSame( $post['post_content'], $out->post_content );
+ $this->assertSame( $post['post_title'], $out->post_title );
+ $this->assertSame( $post['post_status'], $out->post_status );
$this->assertEquals( $post['post_author'], $out->post_author );
// Test cache state.
$pcache = wp_cache_get( $id, 'posts' );
$this->assertInstanceOf( 'stdClass', $pcache );
- $this->assertEquals( $id, $pcache->ID );
+ $this->assertSame( $id, $pcache->ID );
update_object_term_cache( $id, $post_type );
$tcache = wp_cache_get( $id, 'post_tag_relationships' );
$this->assertInternalType( 'array', $tcache );
- $this->assertEquals( 2, count( $tcache ) );
+ $this->assertSame( 2, count( $tcache ) );
$tcache = wp_cache_get( $id, 'ctax_relationships' );
if ( 'cpt' === $post_type ) {
$this->assertInternalType( 'array', $tcache );
- $this->assertEquals( 2, count( $tcache ) );
+ $this->assertSame( 2, count( $tcache ) );
} else {
$this->assertFalse( $tcache );
}
@@ -141,14 +141,14 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure it matches.
$out = get_post( $id );
- $this->assertEquals( $post['post_content'], $out->post_content );
- $this->assertEquals( $post['post_title'], $out->post_title );
- $this->assertEquals( 'future', $out->post_status );
+ $this->assertSame( $post['post_content'], $out->post_content );
+ $this->assertSame( $post['post_title'], $out->post_title );
+ $this->assertSame( 'future', $out->post_status );
$this->assertEquals( $post['post_author'], $out->post_author );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( $post['post_date'], $out->post_date );
// There should be a publish_future_post hook scheduled on the future date.
- $this->assertEquals( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
/**
@@ -173,11 +173,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure has the correct date and status.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// Check that there's a publish_future_post job scheduled at the right time.
- $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
// Now save it again with a date further in the future.
@@ -188,11 +188,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post again and make sure it has the new post_date.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// And the correct date on the cron job.
- $this->assertEquals( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
/**
@@ -218,11 +218,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure has the correct date and status.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// Check that there's a publish_future_post job scheduled at the right time.
- $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
// Now save it again with a date further in the future.
@@ -233,11 +233,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post again and make sure it has the new post_date.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// And the correct date on the cron job.
- $this->assertEquals( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
/**
@@ -264,14 +264,14 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure it matches.
$out = get_post( $id );
- $this->assertEquals( $post['post_content'], $out->post_content );
- $this->assertEquals( $post['post_title'], $out->post_title );
- $this->assertEquals( 'draft', $out->post_status );
+ $this->assertSame( $post['post_content'], $out->post_content );
+ $this->assertSame( $post['post_title'], $out->post_title );
+ $this->assertSame( 'draft', $out->post_status );
$this->assertEquals( $post['post_author'], $out->post_author );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( $post['post_date'], $out->post_date );
// There should be a publish_future_post hook scheduled on the future date.
- $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
@@ -295,11 +295,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure has the correct date and status.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// Check that there's a publish_future_post job scheduled at the right time.
- $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
// Now save it again with status set to draft.
@@ -309,11 +309,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post again and make sure it has the new post_date.
$out = get_post( $id );
- $this->assertEquals( 'draft', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'draft', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// And the correct date on the cron job.
- $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
/**
@@ -339,11 +339,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure has the correct date and status.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// Check that there's a publish_future_post job scheduled at the right time.
- $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
// Now save it again with status changed.
@@ -353,11 +353,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post again and make sure it has the new post_date.
$out = get_post( $id );
- $this->assertEquals( $status, $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( $status, $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// And the correct date on the cron job.
- $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
}
@@ -385,14 +385,14 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure it matches.
$out = get_post( $id );
- $this->assertEquals( $post['post_content'], $out->post_content );
- $this->assertEquals( $post['post_title'], $out->post_title );
- $this->assertEquals( 'private', $out->post_status );
+ $this->assertSame( $post['post_content'], $out->post_content );
+ $this->assertSame( $post['post_title'], $out->post_title );
+ $this->assertSame( 'private', $out->post_status );
$this->assertEquals( $post['post_author'], $out->post_author );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( $post['post_date'], $out->post_date );
// There should be a publish_future_post hook scheduled on the future date.
- $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
/**
@@ -412,10 +412,10 @@ class Tests_Post extends WP_UnitTestCase {
// Test both return paths with or without WP_Error.
$insert_post = wp_insert_post( $post, true );
$this->assertWPError( $insert_post );
- $this->assertEquals( 'invalid_date', $insert_post->get_error_code() );
+ $this->assertSame( 'invalid_date', $insert_post->get_error_code() );
$insert_post = wp_insert_post( $post );
- $this->assertEquals( 0, $insert_post );
+ $this->assertSame( 0, $insert_post );
}
/**
@@ -438,11 +438,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post and make sure has the correct date and status.
$out = get_post( $id );
- $this->assertEquals( 'future', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'future', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// Check that there's a publish_future_post job scheduled at the right time.
- $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
// Now save it again with status set to draft.
@@ -452,11 +452,11 @@ class Tests_Post extends WP_UnitTestCase {
// Fetch the post again and make sure it has the new post_date.
$out = get_post( $id );
- $this->assertEquals( 'private', $out->post_status );
- $this->assertEquals( $post['post_date'], $out->post_date );
+ $this->assertSame( 'private', $out->post_status );
+ $this->assertSame( $post['post_date'], $out->post_date );
// And the correct date on the cron job.
- $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
}
/**
@@ -478,7 +478,7 @@ class Tests_Post extends WP_UnitTestCase {
$this->set_permalink_structure();
- $this->assertEquals( "$p-2", $post->post_name );
+ $this->assertSame( "$p-2", $post->post_name );
}
/**
@@ -518,8 +518,8 @@ class Tests_Post extends WP_UnitTestCase {
)
);
- $this->assertEquals( 'world', get_post_meta( $post_id, 'hello', true ) );
- $this->assertEquals( 'bar', get_post_meta( $post_id, 'foo', true ) );
+ $this->assertSame( 'world', get_post_meta( $post_id, 'hello', true ) );
+ $this->assertSame( 'bar', get_post_meta( $post_id, 'foo', true ) );
}
/**
@@ -543,7 +543,7 @@ class Tests_Post extends WP_UnitTestCase {
$this->post_ids[] = $id;
// Check that there's a publish_future_post job scheduled at the right time.
- $this->assertEquals( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
+ $this->assertSame( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
// Now delete the post and make sure the cron entry is removed.
wp_delete_post( $id );
@@ -576,19 +576,19 @@ class Tests_Post extends WP_UnitTestCase {
$plink = get_permalink( $id );
// Permalink should include the post ID at the end.
- $this->assertEquals( get_option( 'siteurl' ) . '/2007/10/31/' . $id . '/', $plink );
+ $this->assertSame( get_option( 'siteurl' ) . '/2007/10/31/' . $id . '/', $plink );
}
function test_wp_publish_post() {
$draft_id = self::factory()->post->create( array( 'post_status' => 'draft' ) );
$post = get_post( $draft_id );
- $this->assertEquals( 'draft', $post->post_status );
+ $this->assertSame( 'draft', $post->post_status );
wp_publish_post( $draft_id );
$post = get_post( $draft_id );
- $this->assertEquals( 'publish', $post->post_status );
+ $this->assertSame( 'publish', $post->post_status );
}
/**
@@ -604,14 +604,14 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- $this->assertEquals( 'future', $post->post_status );
- $this->assertEquals( $future_date, $post->post_date );
+ $this->assertSame( 'future', $post->post_status );
+ $this->assertSame( $future_date, $post->post_date );
wp_publish_post( $post_id );
$post = get_post( $post_id );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( $future_date, $post->post_date );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( $future_date, $post->post_date );
}
/**
@@ -626,8 +626,8 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- $this->assertEquals( 'publish', $post->post_status );
- $this->assertEquals( $future_date, $post->post_date );
+ $this->assertSame( 'publish', $post->post_status );
+ $this->assertSame( $future_date, $post->post_date );
}
/**
@@ -638,8 +638,8 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = wp_insert_post( array( 'post_title' => '' ) );
$post = get_post( $post_id );
- $this->assertEquals( '', $post->post_title );
- $this->assertEquals( 'draft', $post->post_status );
+ $this->assertSame( '', $post->post_title );
+ $this->assertSame( 'draft', $post->post_status );
kses_init_filters();
@@ -650,7 +650,7 @@ class Tests_Post extends WP_UnitTestCase {
)
);
$post = get_post( $post->ID );
- $this->assertEquals( 'Test', $post->post_title );
+ $this->assertSame( 'Test', $post->post_title );
kses_remove_filters();
}
@@ -663,14 +663,14 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = wp_insert_post( array( 'post_title' => '' ) );
$post = get_post( $post_id );
- $this->assertEquals( '', $post->post_title );
- $this->assertEquals( 'draft', $post->post_status );
+ $this->assertSame( '', $post->post_title );
+ $this->assertSame( 'draft', $post->post_status );
kses_init_filters();
wp_publish_post( $post->ID );
$post = get_post( $post->ID );
- $this->assertEquals( '', $post->post_title );
+ $this->assertSame( '', $post->post_title );
kses_remove_filters();
}
@@ -682,7 +682,7 @@ class Tests_Post extends WP_UnitTestCase {
global $post;
$parent_id = self::factory()->post->create();
$post = self::factory()->post->create_and_get( array( 'post_parent' => $parent_id ) );
- $this->assertEquals( array( $parent_id ), get_post_ancestors( 0 ) );
+ $this->assertSame( array( $parent_id ), get_post_ancestors( 0 ) );
}
/**
@@ -694,8 +694,8 @@ class Tests_Post extends WP_UnitTestCase {
$post['ID'] = 123456789;
- $this->assertEquals( 0, wp_insert_post( $post ) );
- $this->assertEquals( 0, wp_update_post( $post ) );
+ $this->assertSame( 0, wp_insert_post( $post ) );
+ $this->assertSame( 0, wp_update_post( $post ) );
$this->assertInstanceOf( 'WP_Error', wp_insert_post( $post, true ) );
$this->assertInstanceOf( 'WP_Error', wp_update_post( $post, true ) );
@@ -707,10 +707,10 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) );
$post = get_post( $post_id );
setup_postdata( $post );
- $this->assertEquals( 0, $multipage );
+ $this->assertSame( 0, $multipage );
$this->assertCount( 1, $pages );
- $this->assertEquals( 1, $numpages );
- $this->assertEquals( array( 'Page 0' ), $pages );
+ $this->assertSame( 1, $numpages );
+ $this->assertSame( array( 'Page 0' ), $pages );
}
function test_parse_post_content_multi_page() {
@@ -718,10 +718,10 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_content' => 'Page 0Page 1Page 2Page 3' ) );
$post = get_post( $post_id );
setup_postdata( $post );
- $this->assertEquals( 1, $multipage );
+ $this->assertSame( 1, $multipage );
$this->assertCount( 4, $pages );
- $this->assertEquals( 4, $numpages );
- $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
+ $this->assertSame( 4, $numpages );
+ $this->assertSame( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
}
function test_parse_post_content_remaining_single_page() {
@@ -729,10 +729,10 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) );
$post = get_post( $post_id );
setup_postdata( $post );
- $this->assertEquals( 0, $multipage );
+ $this->assertSame( 0, $multipage );
$this->assertCount( 1, $pages );
- $this->assertEquals( 1, $numpages );
- $this->assertEquals( array( 'Page 0' ), $pages );
+ $this->assertSame( 1, $numpages );
+ $this->assertSame( array( 'Page 0' ), $pages );
}
function test_parse_post_content_remaining_multi_page() {
@@ -740,10 +740,10 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_content' => 'Page 0Page 1Page 2Page 3' ) );
$post = get_post( $post_id );
setup_postdata( $post );
- $this->assertEquals( 1, $multipage );
+ $this->assertSame( 1, $multipage );
$this->assertCount( 4, $pages );
- $this->assertEquals( 4, $numpages );
- $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
+ $this->assertSame( 4, $numpages );
+ $this->assertSame( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
}
/**
@@ -754,10 +754,10 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_content' => 'Page 0Page 1Page 2Page 3' ) );
$post = get_post( $post_id );
setup_postdata( $post );
- $this->assertEquals( 1, $multipage );
+ $this->assertSame( 1, $multipage );
$this->assertCount( 4, $pages );
- $this->assertEquals( 4, $numpages );
- $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
+ $this->assertSame( 4, $numpages );
+ $this->assertSame( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
}
/**
@@ -768,10 +768,10 @@ class Tests_Post extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) );
$post = get_post( $post_id );
setup_postdata( $post );
- $this->assertEquals( 0, $multipage );
+ $this->assertSame( 0, $multipage );
$this->assertCount( 1, $pages );
- $this->assertEquals( 1, $numpages );
- $this->assertEquals( array( 'Page 0' ), $pages );
+ $this->assertSame( 1, $numpages );
+ $this->assertSame( array( 'Page 0' ), $pages );
}
/**
@@ -797,7 +797,7 @@ class Tests_Post extends WP_UnitTestCase {
$post = get_post( $insert_post_id );
$this->assertEquals( $post->post_author, self::$editor_id );
- $this->assertEquals( $post->post_title, $title );
+ $this->assertSame( $post->post_title, $title );
}
/**
@@ -852,7 +852,7 @@ class Tests_Post extends WP_UnitTestCase {
$_post['post_status'] = 'draft';
wp_insert_post( $_post );
$post = get_post( $post_ids[ $key ] );
- $this->assertEquals( 'draft', $post->post_status );
+ $this->assertSame( 'draft', $post->post_status );
$this->assertNotEquals( 'publish', $post->post_status );
$after_draft_counts = wp_count_posts();
@@ -870,7 +870,7 @@ class Tests_Post extends WP_UnitTestCase {
wp_trash_post( $post_ids[ $key ] );
$post = get_post( $post_ids[ $key ] );
- $this->assertEquals( 'trash', $post->post_status );
+ $this->assertSame( 'trash', $post->post_status );
$this->assertNotEquals( 'publish', $post->post_status );
$after_trash_counts = wp_count_posts();
@@ -892,7 +892,7 @@ class Tests_Post extends WP_UnitTestCase {
$counts = wp_count_posts();
$this->assertTrue( isset( $counts->test ) );
- $this->assertEquals( 0, $counts->test );
+ $this->assertSame( 0, $counts->test );
}
/**
@@ -960,7 +960,7 @@ class Tests_Post extends WP_UnitTestCase {
$post = get_post( $post_id );
foreach ( $expected as $field => $value ) {
- $this->assertEquals( $value, $post->$field );
+ $this->assertSame( $value, $post->$field );
}
}
@@ -978,8 +978,8 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- $this->assertEquals( 'open', $post->comment_status );
- $this->assertEquals( 'open', $post->ping_status );
+ $this->assertSame( 'open', $post->comment_status );
+ $this->assertSame( 'open', $post->ping_status );
}
/**
@@ -997,8 +997,8 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- $this->assertEquals( 'closed', $post->comment_status );
- $this->assertEquals( 'closed', $post->ping_status );
+ $this->assertSame( 'closed', $post->comment_status );
+ $this->assertSame( 'closed', $post->ping_status );
}
/**
@@ -1018,8 +1018,8 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- $this->assertEquals( 'open', $post->comment_status );
- $this->assertEquals( 'open', $post->ping_status );
+ $this->assertSame( 'open', $post->comment_status );
+ $this->assertSame( 'open', $post->ping_status );
_unregister_post_type( $post_type );
}
@@ -1040,8 +1040,8 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- $this->assertEquals( 'closed', $post->comment_status );
- $this->assertEquals( 'closed', $post->ping_status );
+ $this->assertSame( 'closed', $post->comment_status );
+ $this->assertSame( 'closed', $post->ping_status );
_unregister_post_type( $post_type );
}
@@ -1079,8 +1079,8 @@ class Tests_Post extends WP_UnitTestCase {
// Make sure it's still sticky.
$saved_post = get_post( $post->ID );
$this->assertTrue( is_sticky( $saved_post->ID ) );
- $this->assertEquals( 'Updated', $saved_post->post_title );
- $this->assertEquals( 'Updated', $saved_post->post_content );
+ $this->assertSame( 'Updated', $saved_post->post_title );
+ $this->assertSame( 'Updated', $saved_post->post_content );
}
/**
@@ -1120,8 +1120,8 @@ class Tests_Post extends WP_UnitTestCase {
// Make sure it's still sticky.
$saved_post = get_post( $post->ID );
$this->assertTrue( is_sticky( $saved_post->ID ) );
- $this->assertEquals( 'Updated', $saved_post->post_title );
- $this->assertEquals( 'Updated', $saved_post->post_content );
+ $this->assertSame( 'Updated', $saved_post->post_title );
+ $this->assertSame( 'Updated', $saved_post->post_content );
}
/**
@@ -1147,8 +1147,8 @@ class Tests_Post extends WP_UnitTestCase {
remove_action( 'post_stuck', array( $a1, 'action' ) );
remove_action( 'post_unstuck', array( $a2, 'action' ) );
- $this->assertEquals( 1, $a1->get_call_count() );
- $this->assertEquals( 1, $a2->get_call_count() );
+ $this->assertSame( 1, $a1->get_call_count() );
+ $this->assertSame( 1, $a2->get_call_count() );
}
/**
@@ -1174,7 +1174,7 @@ class Tests_Post extends WP_UnitTestCase {
$updated_post = get_post( $post_id );
// Ensure changing the post_title didn't modify the post_name.
- $this->assertEquals( 'stuff', $updated_post->post_name );
+ $this->assertSame( 'stuff', $updated_post->post_name );
}
/**
@@ -1212,11 +1212,11 @@ class Tests_Post extends WP_UnitTestCase {
$out = get_post( $id );
- $this->assertEquals( $post['post_content'], $out->post_content );
- $this->assertEquals( $post['post_title'], $out->post_title );
+ $this->assertSame( $post['post_content'], $out->post_content );
+ $this->assertSame( $post['post_title'], $out->post_title );
$this->assertEquals( $post['post_author'], $out->post_author );
- $this->assertEquals( get_date_from_gmt( $post['post_date_gmt'] ), $out->post_date );
- $this->assertEquals( $post['post_date_gmt'], $out->post_date_gmt );
+ $this->assertSame( get_date_from_gmt( $post['post_date_gmt'] ), $out->post_date );
+ $this->assertSame( $post['post_date_gmt'], $out->post_date_gmt );
}
function test_wp_delete_post_reassign_hierarchical_post_type() {
@@ -1233,11 +1233,11 @@ class Tests_Post extends WP_UnitTestCase {
'post_parent' => $parent_page_id,
)
);
- $this->assertEquals( $parent_page_id, get_post( $page_id )->post_parent );
+ $this->assertSame( $parent_page_id, get_post( $page_id )->post_parent );
wp_delete_post( $parent_page_id, true );
- $this->assertEquals( $grandparent_page_id, get_post( $page_id )->post_parent );
+ $this->assertSame( $grandparent_page_id, get_post( $page_id )->post_parent );
wp_delete_post( $grandparent_page_id, true );
- $this->assertEquals( 0, get_post( $page_id )->post_parent );
+ $this->assertSame( 0, get_post( $page_id )->post_parent );
}
/**
@@ -1248,7 +1248,7 @@ class Tests_Post extends WP_UnitTestCase {
*/
function test_wp_insert_post_for_customize_changeset_should_not_drop_post_name() {
- $this->assertEquals( 10, has_filter( 'wp_insert_post_data', '_wp_customize_changeset_filter_insert_post_data' ) );
+ $this->assertSame( 10, has_filter( 'wp_insert_post_data', '_wp_customize_changeset_filter_insert_post_data' ) );
$changeset_data = array(
'blogname' => array(
@@ -1266,8 +1266,8 @@ class Tests_Post extends WP_UnitTestCase {
'post_content' => wp_json_encode( $changeset_data ),
)
);
- $this->assertEquals( $uuid, get_post( $post_id )->post_name, 'Expected lower-case UUID4 to be inserted.' );
- $this->assertEquals( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
+ $this->assertSame( $uuid, get_post( $post_id )->post_name, 'Expected lower-case UUID4 to be inserted.' );
+ $this->assertSame( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
$changeset_data['blogname']['value'] = 'Hola Mundo';
wp_update_post(
@@ -1277,8 +1277,8 @@ class Tests_Post extends WP_UnitTestCase {
'post_content' => wp_json_encode( $changeset_data ),
)
);
- $this->assertEquals( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for drafts.' );
- $this->assertEquals( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
+ $this->assertSame( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for drafts.' );
+ $this->assertSame( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
$changeset_data['blogname']['value'] = 'Hallo Welt';
wp_update_post(
@@ -1288,8 +1288,8 @@ class Tests_Post extends WP_UnitTestCase {
'post_content' => wp_json_encode( $changeset_data ),
)
);
- $this->assertEquals( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for pending.' );
- $this->assertEquals( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
+ $this->assertSame( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for pending.' );
+ $this->assertSame( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
}
/**
@@ -1310,7 +1310,7 @@ class Tests_Post extends WP_UnitTestCase {
)
);
$post = get_post( $post_id );
- $this->assertEquals( 'override-slug-' . $post->post_type, $post->post_name );
+ $this->assertSame( 'override-slug-' . $post->post_type, $post->post_name );
remove_filter( 'pre_wp_unique_post_slug', array( $this, 'filter_pre_wp_unique_post_slug' ), 10, 6 );
}
@@ -1334,7 +1334,7 @@ class Tests_Post extends WP_UnitTestCase {
);
$post = get_post( $post_id );
- self::assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt );
+ self::assertSame( '0000-00-00 00:00:00', $post->post_date_gmt );
}
/**
diff --git a/tests/phpunit/tests/post/attachments.php b/tests/phpunit/tests/post/attachments.php
index 8acb0b0068..8f75c41b5a 100644
--- a/tests/phpunit/tests/post/attachments.php
+++ b/tests/phpunit/tests/post/attachments.php
@@ -39,19 +39,19 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
// medium, medium_large, and full size will both point to the original.
$downsize = image_downsize( $id, 'medium' );
- $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
- $this->assertEquals( 50, $downsize[1] );
- $this->assertEquals( 50, $downsize[2] );
+ $this->assertSame( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
+ $this->assertSame( 50, $downsize[1] );
+ $this->assertSame( 50, $downsize[2] );
$downsize = image_downsize( $id, 'medium_large' );
- $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
- $this->assertEquals( 50, $downsize[1] );
- $this->assertEquals( 50, $downsize[2] );
+ $this->assertSame( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
+ $this->assertSame( 50, $downsize[1] );
+ $this->assertSame( 50, $downsize[2] );
$downsize = image_downsize( $id, 'full' );
- $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
- $this->assertEquals( 50, $downsize[1] );
- $this->assertEquals( 50, $downsize[2] );
+ $this->assertSame( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
+ $this->assertSame( 50, $downsize[1] );
+ $this->assertSame( 50, $downsize[2] );
}
function test_insert_image_thumb_only() {
@@ -72,7 +72,7 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
// Intermediate copies should exist: thumbnail only.
$thumb = image_get_intermediate_size( $id, 'thumbnail' );
- $this->assertEquals( 'a2-small-150x150.jpg', $thumb['file'] );
+ $this->assertSame( 'a2-small-150x150.jpg', $thumb['file'] );
$uploads = wp_upload_dir();
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) );
@@ -81,29 +81,29 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
$this->assertFalse( image_get_intermediate_size( $id, 'medium_large' ) );
// The thumb url should point to the thumbnail intermediate.
- $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url( $id ) );
+ $this->assertSame( $thumb['url'], wp_get_attachment_thumb_url( $id ) );
// image_downsize() should return the correct images and sizes.
$downsize = image_downsize( $id, 'thumbnail' );
- $this->assertEquals( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 150, $downsize[1] );
- $this->assertEquals( 150, $downsize[2] );
+ $this->assertSame( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 150, $downsize[1] );
+ $this->assertSame( 150, $downsize[2] );
// medium, medium_large, and full will both point to the original.
$downsize = image_downsize( $id, 'medium' );
- $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 400, $downsize[1] );
- $this->assertEquals( 300, $downsize[2] );
+ $this->assertSame( 'a2-small.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 400, $downsize[1] );
+ $this->assertSame( 300, $downsize[2] );
$downsize = image_downsize( $id, 'medium_large' );
- $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 400, $downsize[1] );
- $this->assertEquals( 300, $downsize[2] );
+ $this->assertSame( 'a2-small.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 400, $downsize[1] );
+ $this->assertSame( 300, $downsize[2] );
$downsize = image_downsize( $id, 'full' );
- $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 400, $downsize[1] );
- $this->assertEquals( 300, $downsize[2] );
+ $this->assertSame( 'a2-small.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 400, $downsize[1] );
+ $this->assertSame( 300, $downsize[2] );
}
function test_insert_image_medium_sizes() {
@@ -128,40 +128,40 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
// Intermediate copies should exist: thumbnail and medium.
$thumb = image_get_intermediate_size( $id, 'thumbnail' );
- $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
+ $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) );
$medium = image_get_intermediate_size( $id, 'medium' );
- $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
+ $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) );
$medium_large = image_get_intermediate_size( $id, 'medium_large' );
- $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );
+ $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) );
// The thumb url should point to the thumbnail intermediate.
- $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url( $id ) );
+ $this->assertSame( $thumb['url'], wp_get_attachment_thumb_url( $id ) );
// image_downsize() should return the correct images and sizes.
$downsize = image_downsize( $id, 'thumbnail' );
- $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 150, $downsize[1] );
- $this->assertEquals( 150, $downsize[2] );
+ $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 150, $downsize[1] );
+ $this->assertSame( 150, $downsize[2] );
$downsize = image_downsize( $id, 'medium' );
- $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 400, $downsize[1] );
- $this->assertEquals( 602, $downsize[2] );
+ $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 400, $downsize[1] );
+ $this->assertSame( 602, $downsize[2] );
$downsize = image_downsize( $id, 'medium_large' );
- $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 600, $downsize[1] );
- $this->assertEquals( 904, $downsize[2] );
+ $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 600, $downsize[1] );
+ $this->assertSame( 904, $downsize[2] );
$downsize = image_downsize( $id, 'full' );
- $this->assertEquals( '2007-06-17DSC_4173.jpg', wp_basename( $downsize[0] ) );
- $this->assertEquals( 680, $downsize[1] );
- $this->assertEquals( 1024, $downsize[2] );
+ $this->assertSame( '2007-06-17DSC_4173.jpg', wp_basename( $downsize[0] ) );
+ $this->assertSame( 680, $downsize[1] );
+ $this->assertSame( 1024, $downsize[2] );
}
@@ -187,15 +187,15 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
// Check that the file and intermediates exist.
$thumb = image_get_intermediate_size( $id, 'thumbnail' );
- $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
+ $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) );
$medium = image_get_intermediate_size( $id, 'medium' );
- $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
+ $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) );
$medium_large = image_get_intermediate_size( $id, 'medium_large' );
- $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );
+ $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );
$this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) );
$meta = wp_get_attachment_metadata( $id );
@@ -255,7 +255,7 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
wp_update_post( $post );
// Make sure the update didn't remove the attached file.
- $this->assertEquals( $attached_file, get_post_meta( $id, '_wp_attached_file', true ) );
+ $this->assertSame( $attached_file, get_post_meta( $id, '_wp_attached_file', true ) );
}
/**
@@ -272,7 +272,7 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
// Assert that the attachment is an orphan.
$attachment = get_post( $attachment_id );
- $this->assertEquals( $attachment->post_parent, 0 );
+ $this->assertSame( $attachment->post_parent, 0 );
$post_id = wp_insert_post(
array(
@@ -284,7 +284,7 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
// Assert that the attachment has a parent.
wp_insert_attachment( $attachment, '', $post_id );
$attachment = get_post( $attachment_id );
- $this->assertEquals( $attachment->post_parent, $post_id );
+ $this->assertSame( $attachment->post_parent, $post_id );
}
/**
diff --git a/tests/phpunit/tests/post/filtering.php b/tests/phpunit/tests/post/filtering.php
index 937fdc3196..7a3a0cb5c6 100644
--- a/tests/phpunit/tests/post/filtering.php
+++ b/tests/phpunit/tests/post/filtering.php
@@ -36,7 +36,7 @@ EOF;
$id = self::factory()->post->create( array( 'post_content' => $content ) );
$post = get_post( $id );
- $this->assertEquals( $expected, $post->post_content );
+ $this->assertSame( $expected, $post->post_content );
}
// A simple test to make sure unbalanced tags are fixed.
@@ -53,7 +53,7 @@ EOF;
$id = self::factory()->post->create( array( 'post_content' => $content ) );
$post = get_post( $id );
- $this->assertEquals( $expected, $post->post_content );
+ $this->assertSame( $expected, $post->post_content );
}
// Test KSES filtering of disallowed attribute.
@@ -70,7 +70,7 @@ EOF;
$id = self::factory()->post->create( array( 'post_content' => $content ) );
$post = get_post( $id );
- $this->assertEquals( $expected, $post->post_content );
+ $this->assertSame( $expected, $post->post_content );
}
/**
@@ -90,7 +90,7 @@ EOF;
$id = self::factory()->post->create( array( 'post_content' => $content ) );
$post = get_post( $id );
- $this->assertEquals( $expected, $post->post_content );
+ $this->assertSame( $expected, $post->post_content );
}
// Make sure unbalanced tags are untouched when the balance option is off.
@@ -110,6 +110,6 @@ EOF;
$id = self::factory()->post->create( array( 'post_content' => $content ) );
$post = get_post( $id );
- $this->assertEquals( $content, $post->post_content );
+ $this->assertSame( $content, $post->post_content );
}
}
diff --git a/tests/phpunit/tests/post/formats.php b/tests/phpunit/tests/post/formats.php
index f18a821e4d..44cedfc9a6 100644
--- a/tests/phpunit/tests/post/formats.php
+++ b/tests/phpunit/tests/post/formats.php
@@ -17,20 +17,20 @@ class Tests_Post_Formats extends WP_UnitTestCase {
$result = set_post_format( $post_id, 'aside' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 1, count( $result ) );
+ $this->assertSame( 1, count( $result ) );
$format = get_post_format( $post_id );
- $this->assertEquals( 'aside', $format );
+ $this->assertSame( 'aside', $format );
$result = set_post_format( $post_id, 'standard' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 0, count( $result ) );
+ $this->assertSame( 0, count( $result ) );
$result = set_post_format( $post_id, '' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 0, count( $result ) );
+ $this->assertSame( 0, count( $result ) );
}
/**
@@ -45,7 +45,7 @@ class Tests_Post_Formats extends WP_UnitTestCase {
$result = set_post_format( $post_id, 'aside' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 1, count( $result ) );
+ $this->assertSame( 1, count( $result ) );
// The format can be set but not retrieved until it is registered.
$format = get_post_format( $post_id );
$this->assertFalse( $format );
@@ -53,17 +53,17 @@ class Tests_Post_Formats extends WP_UnitTestCase {
add_post_type_support( 'page', 'post-formats' );
// The previous set can now be retrieved.
$format = get_post_format( $post_id );
- $this->assertEquals( 'aside', $format );
+ $this->assertSame( 'aside', $format );
$result = set_post_format( $post_id, 'standard' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 0, count( $result ) );
+ $this->assertSame( 0, count( $result ) );
$result = set_post_format( $post_id, '' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 0, count( $result ) );
+ $this->assertSame( 0, count( $result ) );
remove_post_type_support( 'page', 'post-formats' );
}
@@ -77,13 +77,13 @@ class Tests_Post_Formats extends WP_UnitTestCase {
$result = set_post_format( $post_id, 'aside' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 1, count( $result ) );
+ $this->assertSame( 1, count( $result ) );
$this->assertTrue( has_post_format( 'aside', $post_id ) );
$result = set_post_format( $post_id, 'standard' );
$this->assertNotWPError( $result );
$this->assertInternalType( 'array', $result );
- $this->assertEquals( 0, count( $result ) );
+ $this->assertSame( 0, count( $result ) );
// Standard is a special case. It shows as false when set.
$this->assertFalse( has_post_format( 'standard', $post_id ) );
@@ -113,47 +113,47 @@ $commentary
DATA;
$link_post_id = self::factory()->post->create( array( 'post_content' => $link ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $link_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
$link_with_post_id = self::factory()->post->create( array( 'post_content' => $link_with_commentary ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $link_with_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
$content_link = get_url_in_content( get_post_field( 'post_content', $link_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
$content_link = get_url_in_content( get_post_field( 'post_content', $link_with_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
$empty_post_id = self::factory()->post->create( array( 'post_content' => '' ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
$comm_post_id = self::factory()->post->create( array( 'post_content' => $commentary ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
// Now with an href.
$href_post_id = self::factory()->post->create( array( 'post_content' => $href ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $href_post_id ) );
- $this->assertEquals( $link, $content_link );
+ $this->assertSame( $link, $content_link );
$href_with_post_id = self::factory()->post->create( array( 'post_content' => $href_with_commentary ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $href_with_post_id ) );
- $this->assertEquals( $link, $content_link );
+ $this->assertSame( $link, $content_link );
$content_link = get_url_in_content( get_post_field( 'post_content', $href_post_id ) );
- $this->assertEquals( $link, $content_link );
+ $this->assertSame( $link, $content_link );
$content_link = get_url_in_content( get_post_field( 'post_content', $href_with_post_id ) );
- $this->assertEquals( $link, $content_link );
+ $this->assertSame( $link, $content_link );
$empty_post_id = self::factory()->post->create( array( 'post_content' => '' ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
$comm_post_id = self::factory()->post->create( array( 'post_content' => $commentary ) );
$content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) );
- $this->assertEquals( false, $content_link );
+ $this->assertFalse( $content_link );
}
}
diff --git a/tests/phpunit/tests/post/getLastPostDate.php b/tests/phpunit/tests/post/getLastPostDate.php
index 00eb80074c..8941c52827 100644
--- a/tests/phpunit/tests/post/getLastPostDate.php
+++ b/tests/phpunit/tests/post/getLastPostDate.php
@@ -52,7 +52,7 @@ class Tests_Post_GetLastPostDate extends WP_UnitTestCase {
)
);
- $this->assertEquals( $post_post_date_last, get_lastpostdate( 'blog', 'post' ) );
- $this->assertEquals( $book_post_date_last, get_lastpostdate( 'blog', 'book' ) );
+ $this->assertSame( $post_post_date_last, get_lastpostdate( 'blog', 'post' ) );
+ $this->assertSame( $book_post_date_last, get_lastpostdate( 'blog', 'book' ) );
}
}
diff --git a/tests/phpunit/tests/post/getLastPostModified.php b/tests/phpunit/tests/post/getLastPostModified.php
index 249656da28..45b2cb651d 100644
--- a/tests/phpunit/tests/post/getLastPostModified.php
+++ b/tests/phpunit/tests/post/getLastPostModified.php
@@ -103,7 +103,7 @@ class Tests_Post_GetLastPostModified extends WP_UnitTestCase {
)
);
- $this->assertEquals( $post_post_modified_last, get_lastpostmodified( 'blog', 'post' ) );
- $this->assertEquals( $book_post_modified_last, get_lastpostmodified( 'blog', 'book' ) );
+ $this->assertSame( $post_post_modified_last, get_lastpostmodified( 'blog', 'post' ) );
+ $this->assertSame( $book_post_modified_last, get_lastpostmodified( 'blog', 'book' ) );
}
}
diff --git a/tests/phpunit/tests/post/getPageByPath.php b/tests/phpunit/tests/post/getPageByPath.php
index 9b288b64f6..f7912b87be 100644
--- a/tests/phpunit/tests/post/getPageByPath.php
+++ b/tests/phpunit/tests/post/getPageByPath.php
@@ -34,8 +34,8 @@ class Tests_Post_GetPageByPath extends WP_UnitTestCase {
$page = get_post( $page->ID );
- $this->assertEquals( 'some-page', $attachment->post_name );
- $this->assertEquals( 'some-page', $page->post_name );
+ $this->assertSame( 'some-page', $attachment->post_name );
+ $this->assertSame( 'some-page', $page->post_name );
// get_page_by_path() should return a post of the requested type before returning an attachment.
$this->assertEquals( $page, get_page_by_path( 'some-page' ) );
diff --git a/tests/phpunit/tests/post/getPageChildren.php b/tests/phpunit/tests/post/getPageChildren.php
index 6bd9d453ce..379f72776c 100644
--- a/tests/phpunit/tests/post/getPageChildren.php
+++ b/tests/phpunit/tests/post/getPageChildren.php
@@ -74,22 +74,22 @@ class Tests_Post_GetPageChildren extends WP_UnitTestCase {
public function test_hierarchical_order_should_be_respected_in_results() {
$expected = array( 100, 101, 103, 102, 106, 107, 108, 105 );
$actual = get_page_children( 0, $this->pages );
- $this->assertEquals( $expected, wp_list_pluck( $actual, 'ID' ) );
+ $this->assertSame( $expected, wp_list_pluck( $actual, 'ID' ) );
}
public function test_not_all_pages_should_be_returned_when_page_id_is_in_the_middle_of_the_tree() {
$expected = array( 106, 107, 108 );
$actual = get_page_children( 102, $this->pages );
- $this->assertEquals( $expected, wp_list_pluck( $actual, 'ID' ) );
+ $this->assertSame( $expected, wp_list_pluck( $actual, 'ID' ) );
}
public function test_page_id_that_is_a_leaf_should_return_empty_array() {
$actual = get_page_children( 103, $this->pages );
- $this->assertEquals( array(), $actual );
+ $this->assertSame( array(), $actual );
}
public function test_nonzero_page_id_not_matching_any_actual_post_id_should_return_empty_array() {
$actual = get_page_children( 200, $this->pages );
- $this->assertEquals( array(), $actual );
+ $this->assertSame( array(), $actual );
}
}
diff --git a/tests/phpunit/tests/post/getPageUri.php b/tests/phpunit/tests/post/getPageUri.php
index 0c302914e6..5e33944c09 100644
--- a/tests/phpunit/tests/post/getPageUri.php
+++ b/tests/phpunit/tests/post/getPageUri.php
@@ -16,7 +16,7 @@ class Tests_Post_getPageUri extends WP_UnitTestCase {
unset( $post_array->ancestors );
// Dummy assertion. If this test fails, it will actually error out on an E_WARNING.
- $this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) );
+ $this->assertSame( 'get-page-uri-post-name', get_page_uri( $post_array ) );
}
/**
@@ -41,14 +41,14 @@ class Tests_Post_getPageUri extends WP_UnitTestCase {
);
// Check the parent for good measure.
- $this->assertEquals( 'parent', get_page_uri( $parent_id ) );
+ $this->assertSame( 'parent', get_page_uri( $parent_id ) );
// Try the child normally.
- $this->assertEquals( 'parent/child', get_page_uri( $child_id ) );
+ $this->assertSame( 'parent/child', get_page_uri( $child_id ) );
// Now delete the parent from the database and check.
wp_delete_post( $parent_id, true );
- $this->assertEquals( 'child', get_page_uri( $child_id ) );
+ $this->assertSame( 'child', get_page_uri( $child_id ) );
}
/**
@@ -71,7 +71,7 @@ class Tests_Post_getPageUri extends WP_UnitTestCase {
)
);
- $this->assertEquals( 'child', get_page_uri( $child_id ) );
+ $this->assertSame( 'child', get_page_uri( $child_id ) );
}
/**
@@ -86,6 +86,6 @@ class Tests_Post_getPageUri extends WP_UnitTestCase {
);
$post = get_post( $post_id );
$this->go_to( get_permalink( $post_id ) );
- $this->assertEquals( 'blood-orange-announces-summer-tour-dates', get_page_uri() );
+ $this->assertSame( 'blood-orange-announces-summer-tour-dates', get_page_uri() );
}
}
diff --git a/tests/phpunit/tests/post/getPages.php b/tests/phpunit/tests/post/getPages.php
index e9e1126259..c85ead1685 100644
--- a/tests/phpunit/tests/post/getPages.php
+++ b/tests/phpunit/tests/post/getPages.php
@@ -20,7 +20,7 @@ class Tests_Post_getPages extends WP_UnitTestCase {
$this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
$pages = get_pages();
- $this->assertEquals( 3, count( $pages ) );
+ $this->assertSame( 3, count( $pages ) );
$time1 = wp_cache_get( 'last_changed', 'posts' );
$this->assertNotEmpty( $time1 );
$num_queries = $wpdb->num_queries;
@@ -30,9 +30,9 @@ class Tests_Post_getPages extends WP_UnitTestCase {
// Again. num_queries and last_changed should remain the same.
$pages = get_pages();
- $this->assertEquals( 3, count( $pages ) );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( 3, count( $pages ) );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
foreach ( $pages as $page ) {
$this->assertInstanceOf( 'WP_Post', $page );
}
@@ -40,9 +40,9 @@ class Tests_Post_getPages extends WP_UnitTestCase {
// Again with different args. last_changed should not increment because of
// different args to get_pages(). num_queries should bump by 1.
$pages = get_pages( array( 'number' => 2 ) );
- $this->assertEquals( 2, count( $pages ) );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( 2, count( $pages ) );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
foreach ( $pages as $page ) {
$this->assertInstanceOf( 'WP_Post', $page );
}
@@ -51,18 +51,18 @@ class Tests_Post_getPages extends WP_UnitTestCase {
// Again. num_queries and last_changed should remain the same.
$pages = get_pages( array( 'number' => 2 ) );
- $this->assertEquals( 2, count( $pages ) );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( 2, count( $pages ) );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
foreach ( $pages as $page ) {
$this->assertInstanceOf( 'WP_Post', $page );
}
// Do the first query again. The interim queries should not affect it.
$pages = get_pages();
- $this->assertEquals( 3, count( $pages ) );
- $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries, $wpdb->num_queries );
+ $this->assertSame( 3, count( $pages ) );
+ $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries, $wpdb->num_queries );
foreach ( $pages as $page ) {
$this->assertInstanceOf( 'WP_Post', $page );
}
@@ -75,9 +75,9 @@ class Tests_Post_getPages extends WP_UnitTestCase {
// last_changed bumped so num_queries should increment.
$pages = get_pages( array( 'number' => 2 ) );
- $this->assertEquals( 2, count( $pages ) );
- $this->assertEquals( $time2, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( 2, count( $pages ) );
+ $this->assertSame( $time2, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
foreach ( $pages as $page ) {
$this->assertInstanceOf( 'WP_Post', $page );
}
@@ -95,9 +95,9 @@ class Tests_Post_getPages extends WP_UnitTestCase {
// num_queries should bump after wp_delete_post() bumps last_changed.
$pages = get_pages();
- $this->assertEquals( 2, count( $pages ) );
- $this->assertEquals( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );
- $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+ $this->assertSame( 2, count( $pages ) );
+ $this->assertSame( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );
+ $this->assertSame( $num_queries + 1, $wpdb->num_queries );
foreach ( $pages as $page ) {
$this->assertInstanceOf( 'WP_Post', $page );
}
@@ -259,7 +259,7 @@ class Tests_Post_getPages extends WP_UnitTestCase {
add_post_meta( $posts[1], 'some-meta-key', '' );
add_post_meta( $posts[2], 'some-meta-key', '1' );
- $this->assertEquals(
+ $this->assertSame(
1,
count(
get_pages(
@@ -270,7 +270,7 @@ class Tests_Post_getPages extends WP_UnitTestCase {
)
)
);
- $this->assertEquals(
+ $this->assertSame(
1,
count(
get_pages(
@@ -281,7 +281,7 @@ class Tests_Post_getPages extends WP_UnitTestCase {
)
)
);
- $this->assertEquals( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) );
+ $this->assertSame( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) );
}
/**
@@ -302,12 +302,12 @@ class Tests_Post_getPages extends WP_UnitTestCase {
$include = get_pages( array( 'include' => $inc ) );
$inc_result = wp_list_pluck( $include, 'ID' );
sort( $inc_result );
- $this->assertEquals( $inc, $inc_result );
+ $this->assertSame( $inc, $inc_result );
$exclude = get_pages( array( 'exclude' => $exc ) );
$exc_result = wp_list_pluck( $exclude, 'ID' );
sort( $exc_result );
- $this->assertEquals( $inc, $exc_result );
+ $this->assertSame( $inc, $exc_result );
}
/**
@@ -376,7 +376,7 @@ class Tests_Post_getPages extends WP_UnitTestCase {
preg_match_all( '#