diff --git a/plugins/managesieve/tests/Script.php b/plugins/managesieve/tests/Script.php
index 04e5dd5487d..d957fdfad52 100644
--- a/plugins/managesieve/tests/Script.php
+++ b/plugins/managesieve/tests/Script.php
@@ -25,7 +25,7 @@ function test_parser($input, $output, $message)
$script = new rcube_sieve_script($input, $caps);
$result = $script->as_text();
- $this->assertEquals(trim($output), trim($result), $message);
+ $this->assertSame(trim($output), trim($result), $message);
}
/**
@@ -81,6 +81,6 @@ function test_tokenizer($num, $input, $output)
{
$res = json_encode(rcube_sieve_script::tokenize($input, $num));
- $this->assertEquals(trim($output), trim($res));
+ $this->assertSame(trim($output), trim($res));
}
}
diff --git a/plugins/password/tests/Password.php b/plugins/password/tests/Password.php
index 48b55027e4f..0fb4b964283 100644
--- a/plugins/password/tests/Password.php
+++ b/plugins/password/tests/Password.php
@@ -41,19 +41,19 @@ function test_driver_cpanel()
$driver_class = $this->load_driver('cpanel');
$error_result = $driver_class::decode_response(false);
- $this->assertEquals($error_result, PASSWORD_CONNECT_ERROR);
+ $this->assertSame($error_result, PASSWORD_CONNECT_ERROR);
$bad_result = $driver_class::decode_response(null);
- $this->assertEquals($bad_result, PASSWORD_CONNECT_ERROR);
+ $this->assertSame($bad_result, PASSWORD_CONNECT_ERROR);
$null_result = $driver_class::decode_response('null');
- $this->assertEquals($null_result, PASSWORD_ERROR);
+ $this->assertSame($null_result, PASSWORD_ERROR);
$malformed_result = $driver_class::decode_response('random {string]!');
- $this->assertEquals($malformed_result, PASSWORD_ERROR);
+ $this->assertSame($malformed_result, PASSWORD_ERROR);
$other_result = $driver_class::decode_response('{"a":"b"}');
- $this->assertEquals($other_result, PASSWORD_ERROR);
+ $this->assertSame($other_result, PASSWORD_ERROR);
$fail_response = '{"data":null,"errors":["Execution of Email::passwdp'
. 'op (api version:3) is not permitted inside of webmail"],"sta'
@@ -65,12 +65,12 @@ function test_driver_cpanel()
'message' => $error_message
];
$fail_result = $driver_class::decode_response($fail_response);
- $this->assertEquals($expected_result, $fail_result);
+ $this->assertSame($expected_result, $fail_result);
$success_response = '{"metadata":{},"data":null,"messages":null,"errors'
. '":null,"status":1}';
$good_result = $driver_class::decode_response($success_response);
- $this->assertEquals($good_result, PASSWORD_SUCCESS);
+ $this->assertSame($good_result, PASSWORD_SUCCESS);
}
/**
diff --git a/tests/Browser/Mail/GetunreadTest.php b/tests/Browser/Mail/GetunreadTest.php
index daf95a082d5..7e821741289 100644
--- a/tests/Browser/Mail/GetunreadTest.php
+++ b/tests/Browser/Mail/GetunreadTest.php
@@ -35,7 +35,7 @@ public function testGetunread()
// Folders list state
$browser->assertVisible('.folderlist li.inbox.unread');
- $this->assertEquals(strval(self::$msgcount), $browser->text('.folderlist li.inbox span.unreadcount'));
+ $this->assertSame(strval(self::$msgcount), $browser->text('.folderlist li.inbox span.unreadcount'));
});
}
}
diff --git a/tests/Browser/Mail/ListTest.php b/tests/Browser/Mail/ListTest.php
index d26e6c675d5..88419df70fb 100644
--- a/tests/Browser/Mail/ListTest.php
+++ b/tests/Browser/Mail/ListTest.php
@@ -31,7 +31,7 @@ public function testList()
// check message list
$browser->assertVisible('#messagelist tbody tr:first-child.unread');
- $this->assertEquals('Test HTML with local and remote image',
+ $this->assertSame('Test HTML with local and remote image',
$browser->text('#messagelist tbody tr:first-child span.subject'));
// Note: This element icon has width=0, use assertPresent() not assertVisible()
diff --git a/tests/Browser/Settings/Preferences/GeneralTest.php b/tests/Browser/Settings/Preferences/GeneralTest.php
index 2bf56d78704..d3ca6601559 100644
--- a/tests/Browser/Settings/Preferences/GeneralTest.php
+++ b/tests/Browser/Settings/Preferences/GeneralTest.php
@@ -156,10 +156,10 @@ public function testPreferencesChange()
$options = array_diff(array_keys($this->settings), ['refresh_interval', 'pretty_date']);
foreach ($options as $option) {
- $this->assertEquals($this->settings[$option], $prefs[$option]);
+ $this->assertSame($this->settings[$option], $prefs[$option]);
}
- $this->assertEquals($this->settings['pretty_date'], $prefs['prettydate']);
- $this->assertEquals($this->settings['refresh_interval'], $prefs['refresh_interval']/60);
+ $this->assertSame($this->settings['pretty_date'], $prefs['prettydate']);
+ $this->assertSame($this->settings['refresh_interval'], $prefs['refresh_interval']/60);
}
}
diff --git a/tests/Framework/Bootstrap.php b/tests/Framework/Bootstrap.php
index c398a2d6b24..97dcdaf21bf 100644
--- a/tests/Framework/Bootstrap.php
+++ b/tests/Framework/Bootstrap.php
@@ -74,7 +74,7 @@ function test_slashify()
foreach ($data as $value => $expected) {
$result = slashify($value);
- $this->assertEquals($expected, $result, "Invalid slashify() result for $value");
+ $this->assertSame($expected, $result, "Invalid slashify() result for $value");
}
}
@@ -96,7 +96,7 @@ function test_unslashify()
foreach ($data as $value => $expected) {
$result = unslashify($value);
- $this->assertEquals($expected, $result, "Invalid unslashify() result for $value");
+ $this->assertSame($expected, $result, "Invalid unslashify() result for $value");
}
}
@@ -118,7 +118,7 @@ function test_get_offset_sec()
foreach ($data as $value => $expected) {
$result = get_offset_sec($value);
- $this->assertEquals($expected, $result, "Invalid get_offset_sec() result for $value");
+ $this->assertSame($expected, $result, "Invalid get_offset_sec() result for $value");
}
}
@@ -142,7 +142,7 @@ function test_array_keys_recursive()
$input_str = 'one,two,three,four,five';
$result_str = implode(',', $result);
- $this->assertEquals($input_str, $result_str, "Invalid array_keys_recursive() result");
+ $this->assertSame($input_str, $result_str, "Invalid array_keys_recursive() result");
}
/**
@@ -175,7 +175,7 @@ function test_abbreviate_string()
foreach ($data as $set) {
$result = abbreviate_string($set[1], $set[2], $set[3], $set[4]);
- $this->assertEquals($set[0], $result);
+ $this->assertSame($set[0], $result);
}
}
@@ -194,7 +194,7 @@ function test_format_email()
foreach ($data as $value => $expected) {
$result = format_email($value);
- $this->assertEquals($expected, $result, "Invalid format_email() result for $value");
+ $this->assertSame($expected, $result, "Invalid format_email() result for $value");
}
}
@@ -215,7 +215,7 @@ function test_format_email_recipient()
foreach ($data as $expected => $value) {
$result = format_email_recipient($value[0], isset($value[1]) ? $value[1] : null);
- $this->assertEquals($expected, $result, "Invalid format_email_recipient()");
+ $this->assertSame($expected, $result, "Invalid format_email_recipient()");
}
}
@@ -253,7 +253,7 @@ function test_is_ascii()
*/
function test_version_parse()
{
- $this->assertEquals('0.9.0', version_parse('0.9-stable'));
- $this->assertEquals('0.9.99', version_parse('0.9-git'));
+ $this->assertSame('0.9.0', version_parse('0.9-stable'));
+ $this->assertSame('0.9.99', version_parse('0.9-git'));
}
}
diff --git a/tests/Framework/Browser.php b/tests/Framework/Browser.php
index 52e5b89c315..5985977c2da 100644
--- a/tests/Framework/Browser.php
+++ b/tests/Framework/Browser.php
@@ -14,12 +14,12 @@ function test_browser($useragent, $opera, $chrome, $ie, $edge, $safari, $mz)
{
$object = $this->getBrowser($useragent);
- $this->assertEquals($opera, $object->opera, 'Check for Opera failed');
- $this->assertEquals($chrome, $object->chrome, 'Check for Chrome failed');
- $this->assertEquals($ie, $object->ie, 'Check for IE failed');
- $this->assertEquals($edge, $object->edge, 'Check for Edge failed');
- $this->assertEquals($safari, $object->safari, 'Check for Safari failed');
- $this->assertEquals($mz, $object->mz, 'Check for MZ failed');
+ $this->assertSame($opera, $object->opera, 'Check for Opera failed');
+ $this->assertSame($chrome, $object->chrome, 'Check for Chrome failed');
+ $this->assertSame($ie, $object->ie, 'Check for IE failed');
+ $this->assertSame($edge, $object->edge, 'Check for Edge failed');
+ $this->assertSame($safari, $object->safari, 'Check for Safari failed');
+ $this->assertSame($mz, $object->mz, 'Check for MZ failed');
}
/**
@@ -29,10 +29,10 @@ function test_os($useragent, $windows, $linux, $unix, $mac)
{
$object = $this->getBrowser($useragent);
- $this->assertEquals($windows, $object->win, 'Check Result of Windows');
- $this->assertEquals($linux, $object->linux, 'Check Result of Linux');
- $this->assertEquals($mac, $object->mac, 'Check Result of Mac');
- $this->assertEquals($unix, $object->unix, 'Check Result of Unix');
+ $this->assertSame($windows, $object->win, 'Check Result of Windows');
+ $this->assertSame($linux, $object->linux, 'Check Result of Linux');
+ $this->assertSame($mac, $object->mac, 'Check Result of Mac');
+ $this->assertSame($unix, $object->unix, 'Check Result of Unix');
}
@@ -42,7 +42,7 @@ function test_os($useragent, $windows, $linux, $unix, $mac)
function test_version($useragent, $version)
{
$object = $this->getBrowser($useragent);
- $this->assertEquals($version, $object->ver);
+ $this->assertSame($version, $object->ver);
}
function versions()
diff --git a/tests/Framework/Charset.php b/tests/Framework/Charset.php
index 2efc48f160c..0fe62c6e461 100644
--- a/tests/Framework/Charset.php
+++ b/tests/Framework/Charset.php
@@ -77,7 +77,7 @@ function data_parse_charset()
*/
function test_parse_charset($input, $output)
{
- $this->assertEquals($output, rcube_charset::parse_charset($input));
+ $this->assertSame($output, rcube_charset::parse_charset($input));
}
/**
@@ -113,7 +113,7 @@ function data_convert()
*/
function test_convert($input, $output, $from, $to)
{
- $this->assertEquals($output, rcube_charset::convert($input, $from, $to));
+ $this->assertSame($output, rcube_charset::convert($input, $from, $to));
}
/**
@@ -131,7 +131,7 @@ function data_utf7_to_utf8()
*/
function test_utf7_to_utf8($input, $output)
{
- $this->assertEquals($output, rcube_charset::utf7_to_utf8($input));
+ $this->assertSame($output, rcube_charset::utf7_to_utf8($input));
}
/**
@@ -149,7 +149,7 @@ function data_utf7imap_to_utf8()
*/
function test_utf7imap_to_utf8($input, $output)
{
- $this->assertEquals($output, rcube_charset::utf7imap_to_utf8($input));
+ $this->assertSame($output, rcube_charset::utf7imap_to_utf8($input));
}
/**
@@ -167,7 +167,7 @@ function data_utf8_to_utf7imap()
*/
function test_utf8_to_utf7imap($input, $output)
{
- $this->assertEquals($output, rcube_charset::utf8_to_utf7imap($input));
+ $this->assertSame($output, rcube_charset::utf8_to_utf7imap($input));
}
/**
@@ -185,7 +185,7 @@ function data_utf16_to_utf8()
*/
function test_utf16_to_utf8($input, $output)
{
- $this->assertEquals($output, rcube_charset::utf16_to_utf8($input));
+ $this->assertSame($output, rcube_charset::utf16_to_utf8($input));
}
/**
@@ -204,7 +204,7 @@ function data_detect()
*/
function test_detect($input, $fallback, $output)
{
- $this->assertEquals($output, rcube_charset::detect($input, $fallback));
+ $this->assertSame($output, rcube_charset::detect($input, $fallback));
}
/**
@@ -222,6 +222,6 @@ function data_detect_with_lang()
*/
function test_detect_with_lang($input, $lang, $output)
{
- $this->assertEquals($output, rcube_charset::detect($input, $output, $lang));
+ $this->assertSame($output, rcube_charset::detect($input, $output, $lang));
}
}
diff --git a/tests/Framework/Csv2vcard.php b/tests/Framework/Csv2vcard.php
index 430204c5532..611dd8ca5f9 100644
--- a/tests/Framework/Csv2vcard.php
+++ b/tests/Framework/Csv2vcard.php
@@ -40,7 +40,7 @@ function test_import_tb_plain()
$vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
$vcard = trim(str_replace("\r\n", "\n", $vcard));
- $this->assertEquals($vcf_text, $vcard);
+ $this->assertSame($vcf_text, $vcard);
}
function test_import_email()
@@ -61,7 +61,7 @@ function test_import_email()
$vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
$vcard = trim(str_replace("\r\n", "\n", $vcard));
- $this->assertEquals($vcf_text, $vcard);
+ $this->assertSame($vcf_text, $vcard);
}
function test_import_gmail()
@@ -79,7 +79,7 @@ function test_import_gmail()
$vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
$vcard = trim(str_replace("\r\n", "\n", $vcard));
- $this->assertEquals($vcf_text, $vcard);
+ $this->assertSame($vcf_text, $vcard);
}
function test_import_outlook()
@@ -97,6 +97,6 @@ function test_import_outlook()
$vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
$vcard = trim(str_replace("\r\n", "\n", $vcard));
- $this->assertEquals($vcf_text, $vcard);
+ $this->assertSame($vcf_text, $vcard);
}
}
diff --git a/tests/Framework/Html.php b/tests/Framework/Html.php
index 618a1be4097..cc0dd900362 100644
--- a/tests/Framework/Html.php
+++ b/tests/Framework/Html.php
@@ -62,7 +62,7 @@ function data_attrib_string()
*/
function test_attrib_string($arg1, $arg2, $expected)
{
- $this->assertEquals($expected, html::attrib_string($arg1, $arg2));
+ $this->assertSame($expected, html::attrib_string($arg1, $arg2));
}
/**
@@ -87,7 +87,7 @@ function data_quote()
*/
function test_quote($str, $expected)
{
- $this->assertEquals($expected, html::quote($str));
+ $this->assertSame($expected, html::quote($str));
}
/**
@@ -129,6 +129,6 @@ function data_parse_attrib_string()
*/
function test_parse_attrib_string($arg1, $expected)
{
- $this->assertEquals($expected, html::parse_attrib_string($arg1));
+ $this->assertSame($expected, html::parse_attrib_string($arg1));
}
}
diff --git a/tests/Framework/Html2text.php b/tests/Framework/Html2text.php
index cd154241f6f..40b2a08c4fc 100644
--- a/tests/Framework/Html2text.php
+++ b/tests/Framework/Html2text.php
@@ -102,7 +102,7 @@ function test_html2text($title, $in, $out)
$ht->set_html($in);
$res = $ht->get_text();
- $this->assertEquals($out, $res, $title);
+ $this->assertSame($out, $res, $title);
}
/**
diff --git a/tests/Framework/Mime.php b/tests/Framework/Mime.php
index 7641cf32f64..929f921a01d 100644
--- a/tests/Framework/Mime.php
+++ b/tests/Framework/Mime.php
@@ -85,9 +85,9 @@ function test_decode_single_address()
foreach ($headers as $idx => $header) {
$res = rcube_mime::decode_address_list($header);
- $this->assertEquals($results[$idx][0], count($res), "Rows number in result for header: " . $header);
- $this->assertEquals($results[$idx][1], $res[1]['name'], "Name part decoding for header: " . $header);
- $this->assertEquals($results[$idx][2], $res[1]['mailto'], "Email part decoding for header: " . $header);
+ $this->assertSame($results[$idx][0], count($res), "Rows number in result for header: " . $header);
+ $this->assertSame($results[$idx][1], $res[1]['name'], "Name part decoding for header: " . $header);
+ $this->assertSame($results[$idx][2], $res[1]['mailto'], "Email part decoding for header: " . $header);
}
}
@@ -130,7 +130,7 @@ function test_decode_address_groups()
foreach ($headers as $idx => $header) {
$res = rcube_mime::decode_address_list($header);
- $this->assertEquals($results[$idx], $res, "Decode address groups (#$idx)");
+ $this->assertSame($results[$idx], $res, "Decode address groups (#$idx)");
}
}
@@ -176,7 +176,7 @@ function test_header_decode_qp()
$res = rcube_mime::decode_mime_string($item['in'], 'UTF-8');
$res = quoted_printable_encode($res);
- $this->assertEquals($item['out'], $res, "Header decoding for: " . $idx);
+ $this->assertSame($item['out'], $res, "Header decoding for: " . $idx);
}
}
@@ -185,7 +185,7 @@ function test_header_decode_qp()
*/
function test_parse_headers()
{
- $this->assertEquals([], rcube_mime::parse_headers(''));
+ $this->assertSame([], rcube_mime::parse_headers(''));
$headers = "Subject: Test\r\n"
@@ -196,7 +196,7 @@ function test_parse_headers()
'to' => 'test@test1.com test@test2.com'
];
- $this->assertEquals($expected, rcube_mime::parse_headers($headers));
+ $this->assertSame($expected, rcube_mime::parse_headers($headers));
}
/**
@@ -207,7 +207,7 @@ function test_format_flowed()
$raw = file_get_contents(TESTS_DIR . 'src/format-flowed-unfolded.txt');
$flowed = file_get_contents(TESTS_DIR . 'src/format-flowed.txt');
- $this->assertEquals($flowed, rcube_mime::format_flowed($raw, 80), "Test correct folding and space-stuffing");
+ $this->assertSame($flowed, rcube_mime::format_flowed($raw, 80), "Test correct folding and space-stuffing");
}
/**
@@ -218,7 +218,7 @@ function test_unfold_flowed()
$flowed = file_get_contents(TESTS_DIR . 'src/format-flowed.txt');
$unfolded = file_get_contents(TESTS_DIR . 'src/format-flowed-unfolded.txt');
- $this->assertEquals($unfolded, rcube_mime::unfold_flowed($flowed), "Test correct unfolding of quoted lines");
+ $this->assertSame($unfolded, rcube_mime::unfold_flowed($flowed), "Test correct unfolding of quoted lines");
}
/**
@@ -233,7 +233,7 @@ function test_unfold_flowed2()
."> \r\n"
."Sed ut perspiciatis unde omnis iste natus error sit voluptatem";
- $this->assertEquals($unfolded, rcube_mime::unfold_flowed($flowed), "Test correct unfolding of quoted lines [2]");
+ $this->assertSame($unfolded, rcube_mime::unfold_flowed($flowed), "Test correct unfolding of quoted lines [2]");
}
/**
@@ -247,7 +247,7 @@ function test_unfold_flowed_delsp()
."しているのを見ました。";
$unfolded = "そしてジョバンニはすぐうしろの天気輪の柱がいつかぼんやりした三角標の形になって、しばらく蛍のように、ぺかぺか消えたりともったりしているのを見ました。";
- $this->assertEquals($unfolded, rcube_mime::unfold_flowed($flowed, null, true), "Test correct unfolding of flowed DelSp=Yes lines");
+ $this->assertSame($unfolded, rcube_mime::unfold_flowed($flowed, null, true), "Test correct unfolding of flowed DelSp=Yes lines");
}
/**
@@ -311,7 +311,7 @@ function test_wordwrap()
];
foreach ($samples as $sample) {
- $this->assertEquals($sample[1], call_user_func_array(['rcube_mime', 'wordwrap'], $sample[0]), "Test text wrapping");
+ $this->assertSame($sample[1], call_user_func_array(['rcube_mime', 'wordwrap'], $sample[0]), "Test text wrapping");
}
}
diff --git a/tests/Framework/StringReplacer.php b/tests/Framework/StringReplacer.php
index bad679f05f2..986a7334f91 100644
--- a/tests/Framework/StringReplacer.php
+++ b/tests/Framework/StringReplacer.php
@@ -60,7 +60,7 @@ function test_replace($input, $output)
$result = $replacer->replace($input);
$result = $replacer->resolve($result);
- $this->assertEquals($output, $result);
+ $this->assertSame($output, $result);
}
/**
diff --git a/tests/Framework/Text2Html.php b/tests/Framework/Text2Html.php
index 75405beb093..763f882f4c2 100644
--- a/tests/Framework/Text2Html.php
+++ b/tests/Framework/Text2Html.php
@@ -117,7 +117,7 @@ function test_text2html($input, $output, $options)
$html = $t2h->get_html();
- $this->assertEquals($output, $html);
+ $this->assertSame($output, $html);
}
/**
@@ -134,7 +134,7 @@ function test_text2html_xss()
. "[<script>evil</script>]:##str_replacement_0##
\n"
. "";
- $this->assertEquals($expected, $html);
+ $this->assertSame($expected, $html);
}
/**
@@ -151,7 +151,7 @@ function test_text2html_xss2()
. "https://google.com
\n"
. "";
- $this->assertEquals($expected, $html);
+ $this->assertSame($expected, $html);
}
/**
@@ -172,7 +172,7 @@ function test_text2html_8021()
$html = $t2h->get_html();
$html = preg_replace('/ (rel|target)="(noreferrer|_blank)"/', '', $html);
- $this->assertEquals($expected, $html);
+ $this->assertSame($expected, $html);
}
/**
@@ -211,6 +211,6 @@ function test_text2html_patches_handling()
$t2h = new rcube_text2html($input, false, ['space' => '_']);
$html = $t2h->get_html();
- $this->assertEquals($expected, $html);
+ $this->assertSame($expected, $html);
}
}
diff --git a/tests/Framework/User.php b/tests/Framework/User.php
index 7d7106a0736..da88d875277 100644
--- a/tests/Framework/User.php
+++ b/tests/Framework/User.php
@@ -170,7 +170,7 @@ function test_query()
$user = rcube_user::query('test@example.com', 'localhost');
- $this->assertEquals(1, $user->ID);
+ $this->assertSame(1, $user->ID);
}
/**
diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
index a41b4b25c5e..32ab45e2453 100644
--- a/tests/Framework/Utils.php
+++ b/tests/Framework/Utils.php
@@ -188,7 +188,7 @@ function test_rep_specialchars_output($type, $mode, $str, $res)
$result = rcube_utils::rep_specialchars_output(
$str, $type ? $type : 'html', $mode ? $mode : 'strict');
- $this->assertEquals($result, $res);
+ $this->assertSame($result, $res);
}
/**
@@ -218,41 +218,41 @@ function test_mod_css_styles()
function test_mod_css_styles_xss()
{
$mod = rcube_utils::mod_css_styles("body.main2cols { background-image: url('../images/leftcol.png'); }", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "No url() values allowed");
+ $this->assertSame("/* evil! */", $mod, "No url() values allowed");
$mod = rcube_utils::mod_css_styles("@import url('http://localhost/somestuff/css/master.css');", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "No import statements");
+ $this->assertSame("/* evil! */", $mod, "No import statements");
$mod = rcube_utils::mod_css_styles("left:expression(document.body.offsetWidth-20)", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "No expression properties");
+ $this->assertSame("/* evil! */", $mod, "No expression properties");
$mod = rcube_utils::mod_css_styles("left:exp/* */ression( alert('xss3') )", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "Don't allow encoding quirks");
+ $this->assertSame("/* evil! */", $mod, "Don't allow encoding quirks");
$mod = rcube_utils::mod_css_styles("background:\\0075\\0072\\00006c( javascript:alert('xss') )", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "Don't allow encoding quirks (2)");
+ $this->assertSame("/* evil! */", $mod, "Don't allow encoding quirks (2)");
$mod = rcube_utils::mod_css_styles("background: \\75 \\72 \\6C ('/images/img.png')", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "Don't allow encoding quirks (3)");
+ $this->assertSame("/* evil! */", $mod, "Don't allow encoding quirks (3)");
$mod = rcube_utils::mod_css_styles("background: u\\r\\l('/images/img.png')", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "Don't allow encoding quirks (4)");
+ $this->assertSame("/* evil! */", $mod, "Don't allow encoding quirks (4)");
// position: fixed (#5264)
$mod = rcube_utils::mod_css_styles(".test { position: fixed; }", 'rcmbody');
- $this->assertEquals("#rcmbody .test { position: absolute; }", $mod, "Replace position:fixed with position:absolute (0)");
+ $this->assertSame("#rcmbody .test { position: absolute; }", $mod, "Replace position:fixed with position:absolute (0)");
$mod = rcube_utils::mod_css_styles(".test { position:\nfixed; }", 'rcmbody');
- $this->assertEquals("#rcmbody .test { position: absolute; }", $mod, "Replace position:fixed with position:absolute (1)");
+ $this->assertSame("#rcmbody .test { position: absolute; }", $mod, "Replace position:fixed with position:absolute (1)");
$mod = rcube_utils::mod_css_styles(".test { position:/**/fixed; }", 'rcmbody');
- $this->assertEquals("#rcmbody .test { position: absolute; }", $mod, "Replace position:fixed with position:absolute (2)");
+ $this->assertSame("#rcmbody .test { position: absolute; }", $mod, "Replace position:fixed with position:absolute (2)");
// position: fixed (#6898)
$mod = rcube_utils::mod_css_styles(".test { position : fixed; top: 0; }", 'rcmbody');
- $this->assertEquals("#rcmbody .test { position: absolute; top: 0; }", $mod, "Replace position:fixed with position:absolute (3)");
+ $this->assertSame("#rcmbody .test { position: absolute; top: 0; }", $mod, "Replace position:fixed with position:absolute (3)");
$mod = rcube_utils::mod_css_styles(".test { position/**/: fixed; top: 0; }", 'rcmbody');
- $this->assertEquals("#rcmbody .test { position: absolute; top: 0; }", $mod, "Replace position:fixed with position:absolute (4)");
+ $this->assertSame("#rcmbody .test { position: absolute; top: 0; }", $mod, "Replace position:fixed with position:absolute (4)");
$mod = rcube_utils::mod_css_styles(".test { position\n: fixed; top: 0; }", 'rcmbody');
- $this->assertEquals("#rcmbody .test { position: absolute; top: 0; }", $mod, "Replace position:fixed with position:absolute (5)");
+ $this->assertSame("#rcmbody .test { position: absolute; top: 0; }", $mod, "Replace position:fixed with position:absolute (5)");
// allow data URIs with images (#5580)
$mod = rcube_utils::mod_css_styles("body { background-image: url(data:image/png;base64,123); }", 'rcmbody');
@@ -784,7 +784,7 @@ function data_idn_convert()
*/
function test_idn_to_ascii($decoded, $encoded)
{
- $this->assertEquals(rcube_utils::idn_to_ascii($decoded), $encoded);
+ $this->assertSame(rcube_utils::idn_to_ascii($decoded), $encoded);
}
/**
@@ -796,7 +796,7 @@ function test_idn_to_ascii($decoded, $encoded)
*/
function test_idn_to_utf8($decoded, $encoded)
{
- $this->assertEquals(rcube_utils::idn_to_utf8($encoded), $decoded);
+ $this->assertSame(rcube_utils::idn_to_utf8($encoded), $decoded);
}
/**
@@ -804,8 +804,8 @@ function test_idn_to_utf8($decoded, $encoded)
*/
function test_idn_to_ascii_special()
{
- $this->assertEquals(rcube_utils::idn_to_ascii('H.S'), 'H.S');
- $this->assertEquals(rcube_utils::idn_to_ascii('d.-h.lastname'), 'd.-h.lastname');
+ $this->assertSame(rcube_utils::idn_to_ascii('H.S'), 'H.S');
+ $this->assertSame(rcube_utils::idn_to_ascii('d.-h.lastname'), 'd.-h.lastname');
}
/**
@@ -828,7 +828,7 @@ function data_parse_host()
*/
function test_parse_host($name, $host, $result)
{
- $this->assertEquals(rcube_utils::parse_host($name, $host), $result);
+ $this->assertSame(rcube_utils::parse_host($name, $host), $result);
}
/**
@@ -885,7 +885,7 @@ function data_remove_subject_prefix()
*/
function test_remove_subject_prefix($mode, $subject, $result)
{
- $this->assertEquals(rcube_utils::remove_subject_prefix($subject, $mode), $result);
+ $this->assertSame(rcube_utils::remove_subject_prefix($subject, $mode), $result);
}
/**
@@ -893,13 +893,13 @@ function test_remove_subject_prefix($mode, $subject, $result)
*/
function test_server_name()
{
- $this->assertEquals('localhost', rcube_utils::server_name('test'));
+ $this->assertSame('localhost', rcube_utils::server_name('test'));
$_SERVER['test'] = 'test.com:843';
- $this->assertEquals('test.com', rcube_utils::server_name('test'));
+ $this->assertSame('test.com', rcube_utils::server_name('test'));
$_SERVER['test'] = 'test.com';
- $this->assertEquals('test.com', rcube_utils::server_name('test'));
+ $this->assertSame('test.com', rcube_utils::server_name('test'));
}
/**
@@ -913,27 +913,27 @@ function test_server_name_trusted_host_patterns()
$rcube->config->set('trusted_host_patterns', ['my.domain.tld']);
StderrMock::start();
- $this->assertEquals('localhost', rcube_utils::server_name('test'));
+ $this->assertSame('localhost', rcube_utils::server_name('test'));
StderrMock::stop();
$this->assertSame("ERROR: Specified host is not trusted. Using 'localhost'.", trim(StderrMock::$output));
$rcube->config->set('trusted_host_patterns', ['test.com']);
StderrMock::start();
- $this->assertEquals('test.com', rcube_utils::server_name('test'));
+ $this->assertSame('test.com', rcube_utils::server_name('test'));
StderrMock::stop();
$_SERVER['test'] = 'subdomain.test.com';
StderrMock::start();
- $this->assertEquals('localhost', rcube_utils::server_name('test'));
+ $this->assertSame('localhost', rcube_utils::server_name('test'));
StderrMock::stop();
$rcube->config->set('trusted_host_patterns', ['^test.com$']);
$_SERVER['test'] = '^test.com$';
StderrMock::start();
- $this->assertEquals('localhost', rcube_utils::server_name('test'));
+ $this->assertSame('localhost', rcube_utils::server_name('test'));
StderrMock::stop();
}
}
diff --git a/tests/Framework/VCard.php b/tests/Framework/VCard.php
index 0784b527b91..46edd7c14e7 100644
--- a/tests/Framework/VCard.php
+++ b/tests/Framework/VCard.php
@@ -17,8 +17,8 @@ function test_parse_one()
$vcard = new rcube_vcard(file_get_contents($this->_srcpath('apple.vcf')));
$this->assertTrue($vcard->business, "Identify as business record");
- $this->assertEquals("Apple Computer AG", $vcard->displayname, "FN => displayname");
- $this->assertEquals("", $vcard->firstname, "No person name set");
+ $this->assertSame("Apple Computer AG", $vcard->displayname, "FN => displayname");
+ $this->assertSame("", $vcard->firstname, "No person name set");
}
function test_parse_two()
@@ -26,10 +26,10 @@ function test_parse_two()
$vcard = new rcube_vcard(file_get_contents($this->_srcpath('johndoe.vcf')), null);
$this->assertFalse($vcard->business, "Identify as private record");
- $this->assertEquals("John Doë", $vcard->displayname, "Decode according to charset attribute");
- $this->assertEquals("roundcube.net", $vcard->organization, "Test organization field");
+ $this->assertSame("John Doë", $vcard->displayname, "Decode according to charset attribute");
+ $this->assertSame("roundcube.net", $vcard->organization, "Test organization field");
$this->assertCount(2, $vcard->email, "List two e-mail addresses");
- $this->assertEquals("roundcube@gmail.com", $vcard->email[0], "Use PREF e-mail as primary");
+ $this->assertSame("roundcube@gmail.com", $vcard->email[0], "Use PREF e-mail as primary");
}
/**
@@ -58,10 +58,10 @@ function test_parse_four()
$vcard = new rcube_vcard($vcard, null);
$vcard = $vcard->get_assoc();
- $this->assertEquals("last;", $vcard['surname'], "Decode backslash character");
- $this->assertEquals("first\\", $vcard['firstname'], "Decode backslash character");
- $this->assertEquals("middle\\;\\", $vcard['middlename'], "Decode backslash character");
- $this->assertEquals("prefix", $vcard['prefix'], "Decode backslash character");
+ $this->assertSame("last;", $vcard['surname'], "Decode backslash character");
+ $this->assertSame("first\\", $vcard['firstname'], "Decode backslash character");
+ $this->assertSame("middle\\;\\", $vcard['middlename'], "Decode backslash character");
+ $this->assertSame("prefix", $vcard['prefix'], "Decode backslash character");
}
/**
@@ -73,9 +73,9 @@ function test_parse_five()
$vcard = new rcube_vcard($vcard, null);
$vcard = $vcard->get_assoc();
- $this->assertEquals("last\\a", $vcard['surname'], "Decode dummy backslash character");
- $this->assertEquals("fir\nst", $vcard['firstname'], "Decode backslash character");
- $this->assertEquals("http://domain.tld", $vcard['website:other'][0], "Decode dummy backslash character");
+ $this->assertSame("last\\a", $vcard['surname'], "Decode dummy backslash character");
+ $this->assertSame("fir\nst", $vcard['firstname'], "Decode backslash character");
+ $this->assertSame("http://domain.tld", $vcard['website:other'][0], "Decode dummy backslash character");
}
/**
@@ -105,12 +105,12 @@ function test_import()
$vcards = rcube_vcard::import($input);
$this->assertCount(2, $vcards, "Detected 2 vcards");
- $this->assertEquals("Apple Computer AG", $vcards[0]->displayname, "FN => displayname");
- $this->assertEquals("John Doë", $vcards[1]->displayname, "Displayname with correct charset");
+ $this->assertSame("Apple Computer AG", $vcards[0]->displayname, "FN => displayname");
+ $this->assertSame("John Doë", $vcards[1]->displayname, "Displayname with correct charset");
// https://github.com/roundcube/roundcubemail/issues/1934
$vcards2 = rcube_vcard::import(file_get_contents($this->_srcpath('thebat.vcf')));
- $this->assertEquals("Iksi=F1ski", quoted_printable_encode($vcards2[0]->surname));
+ $this->assertSame("Iksi=F1ski", quoted_printable_encode($vcards2[0]->surname));
$vcards[0]->reset();
// TODO: Test reset() method
@@ -127,8 +127,8 @@ function test_import_photo_encoding()
$vcard = $vcards[0]->get_assoc();
// ENCODING=b case (#1488683)
- $this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
- $this->assertEquals("Müller", $vcard['surname'], "Unicode characters");
+ $this->assertSame("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
+ $this->assertSame("Müller", $vcard['surname'], "Unicode characters");
$input = str_replace('ENCODING=b:', 'ENCODING=base64;jpeg:', $input);
@@ -136,7 +136,7 @@ function test_import_photo_encoding()
$vcard = $vcards[0]->get_assoc();
// ENCODING=base64 case (#1489977)
- $this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
+ $this->assertSame("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
$input = str_replace('PHOTO;ENCODING=base64;jpeg:', 'PHOTO:data:image/jpeg;base64,', $input);
@@ -144,7 +144,7 @@ function test_import_photo_encoding()
$vcard = $vcards[0]->get_assoc();
// vcard4.0 "PHOTO:data:image/jpeg;base64," case (#1489977)
- $this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
+ $this->assertSame("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
}
function test_encodings()
@@ -152,7 +152,7 @@ function test_encodings()
$input = file_get_contents($this->_srcpath('utf-16_sample.vcf'));
$vcards = rcube_vcard::import($input);
- $this->assertEquals("Ǽgean ĽdaMonté", $vcards[0]->displayname, "Decoded from UTF-16");
+ $this->assertSame("Ǽgean ĽdaMonté", $vcards[0]->displayname, "Decoded from UTF-16");
}
/**
@@ -175,8 +175,8 @@ function test_parse_skip_empty()
$this->assertCount(1, $result['phone:home'], "TYPE=home entry exists");
$this->assertTrue(!isset($result['phone:mobile']), "TYPE=CELL entry ignored");
$this->assertCount(5, $result['address:home'][0], "ADR with some fields missing");
- $this->assertEquals($result['address:home'][0]['zipcode'], 'zip', "ADR with some fields missing (1)");
- $this->assertEquals($result['address:home'][0]['street'], 'street', "ADR with some fields missing (2)");
+ $this->assertSame($result['address:home'][0]['zipcode'], 'zip', "ADR with some fields missing (1)");
+ $this->assertSame($result['address:home'][0]['street'], 'street', "ADR with some fields missing (2)");
}
/**
@@ -188,7 +188,7 @@ function test_bday_v4()
$vcard = new rcube_vcard($vcard, null);
$vcard = $vcard->get_assoc();
- $this->assertEquals("1980-02-02", $vcard['birthday'][0]);
+ $this->assertSame("1980-02-02", $vcard['birthday'][0]);
}
/**
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php
index f9757f3871c..b825e382d3a 100644
--- a/tests/Framework/Washtml.php
+++ b/tests/Framework/Washtml.php
@@ -109,32 +109,32 @@ function test_comments()
$html = "
p2
"; $washed = $this->cleanupResult($washer->wash($html)); - $this->assertEquals('p2
', $washed, "HTML conditional comments (#1489004)"); + $this->assertSame('p2
', $washed, "HTML conditional comments (#1489004)"); $html = "para2
"; $washed = $this->cleanupResult($washer->wash($html)); - $this->assertEquals('para1
para2
', $washed, "HTML comments - simple comment"); + $this->assertSame('para1
para2
', $washed, "HTML comments - simple comment"); $html = "para1
para2
"; $washed = $this->cleanupResult($washer->wash($html)); - $this->assertEquals('para1
para2
', $washed, "HTML comments - tags inside (#1489904)"); + $this->assertSame('para1
para2
', $washed, "HTML comments - tags inside (#1489904)"); $html = "para1
para2
"; $washed = $this->cleanupResult($washer->wash($html)); - $this->assertEquals('para1
para2
', $washed, "HTML comments - bracket inside"); + $this->assertSame('para1
para2
', $washed, "HTML comments - bracket inside"); $html = "\n2\n4
"; $washed = $this->cleanupResult($washer->wash($html)); - $this->assertEquals("\n2\n4
", $washed, "HTML comments (#6464)"); + $this->assertSame("\n2\n4
", $washed, "HTML comments (#6464)"); } /** diff --git a/tests/Rcmail/OutputHtml.php b/tests/Rcmail/OutputHtml.php index 88b61c5a176..35093bedef9 100644 --- a/tests/Rcmail/OutputHtml.php +++ b/tests/Rcmail/OutputHtml.php @@ -322,7 +322,7 @@ function test_conditions($input, $output) $object = new rcmail_output_html; $result = $object->just_parse($input); - $this->assertEquals($output, $result); + $this->assertSame($output, $result); } /** diff --git a/tests/Rcmail/Rcmail.php b/tests/Rcmail/Rcmail.php index fb80e5c7a39..86a03c75dcb 100644 --- a/tests/Rcmail/Rcmail.php +++ b/tests/Rcmail/Rcmail.php @@ -126,32 +126,32 @@ function test_url() { $rcmail = rcmail::get_instance(); - $this->assertEquals( + $this->assertSame( '/sub/?_task=cli&_action=test', $rcmail->url('test'), "Action only" ); - $this->assertEquals( + $this->assertSame( '/sub/?_task=cli&_action=test&_a=AA', $rcmail->url(['action' => 'test', 'a' => 'AA']), "Unprefixed parameters" ); - $this->assertEquals( + $this->assertSame( '/sub/?_task=cli&_action=test&_b=BB', $rcmail->url(['_action' => 'test', '_b' => 'BB', '_c' => null]), "Prefixed parameters (skip empty)" ); - $this->assertEquals('/sub/?_task=cli', $rcmail->url([]), "Empty input"); + $this->assertSame('/sub/?_task=cli', $rcmail->url([]), "Empty input"); - $this->assertEquals( + $this->assertSame( '/sub/?_task=cli&_action=test&_mode=ABS', $rcmail->url(['_action' => 'test', '_mode' => 'ABS'], true), "Absolute URL" ); - $this->assertEquals( + $this->assertSame( 'https://mail.example.org/sub/?_task=calendar&_action=test&_mode=FQ', $rcmail->url(['task' => 'calendar', '_action' => 'test', '_mode' => 'FQ'], true, true), "Fully Qualified URL" @@ -159,36 +159,36 @@ function test_url() // with different SCRIPT_NAME values $_SERVER['SCRIPT_NAME'] = 'index.php'; - $this->assertEquals( + $this->assertSame( '/?_task=cli&_action=test&_mode=ABS', $rcmail->url(['_action' => 'test', '_mode' => 'ABS'], true), "Absolute URL (root)" ); $_SERVER['SCRIPT_NAME'] = ''; - $this->assertEquals( + $this->assertSame( '/?_task=cli&_action=test&_mode=ABS', $rcmail->url(['_action' => 'test', '_mode' => 'ABS'], true), "Absolute URL (root)" ); $_SERVER['REQUEST_URI'] = '/rc/?_task=mail'; - $this->assertEquals('/rc/?_task=cli', $rcmail->url([]), "Empty input with REQUEST_URI prefix"); + $this->assertSame('/rc/?_task=cli', $rcmail->url([]), "Empty input with REQUEST_URI prefix"); $rcmail->config->set('request_path', 'X_FORWARDED_PATH'); - $this->assertEquals('/proxied/?_task=cli', $rcmail->url([]), "Consider request_path config (_SERVER)"); + $this->assertSame('/proxied/?_task=cli', $rcmail->url([]), "Consider request_path config (_SERVER)"); $rcmail->config->set('request_path', '/test'); - $this->assertEquals('/test/?_task=cli', $rcmail->url([]), "Consider request_path config (/path)"); + $this->assertSame('/test/?_task=cli', $rcmail->url([]), "Consider request_path config (/path)"); $rcmail->config->set('request_path', '/test/'); - $this->assertEquals('/test/?_task=cli', $rcmail->url([]), "Consider request_path config (/path/)"); + $this->assertSame('/test/?_task=cli', $rcmail->url([]), "Consider request_path config (/path/)"); $_SERVER['REQUEST_URI'] = null; $rcmail->config->set('request_path', null); $_SERVER['HTTPS'] = false; $_SERVER['SERVER_PORT'] = '8080'; - $this->assertEquals( + $this->assertSame( 'http://mail.example.org:8080/?_task=cli&_action=test&_mode=ABS', $rcmail->url(['_action' => 'test', '_mode' => 'ABS'], true, true), "Full URL with port" diff --git a/tests/Rcmail/Sendmail.php b/tests/Rcmail/Sendmail.php index 5fd3c740502..521af50142e 100644 --- a/tests/Rcmail/Sendmail.php +++ b/tests/Rcmail/Sendmail.php @@ -156,7 +156,7 @@ function test_email_input_format($input, $output, $charset) $sendmail = new rcmail_sendmail(); $sendmail->options['charset'] = $charset; - $this->assertEquals($output, $sendmail->email_input_format($input)); + $this->assertSame($output, $sendmail->email_input_format($input)); } /** @@ -174,23 +174,23 @@ function test_draftinfo_encode_and_decode() { $input = ['test' => 'test']; $result = rcmail_sendmail::draftinfo_encode($input); - $this->assertEquals('test=test', $result); - $this->assertEquals($input, rcmail_sendmail::draftinfo_decode($result)); + $this->assertSame('test=test', $result); + $this->assertSame($input, rcmail_sendmail::draftinfo_decode($result)); $input = ['folder' => 'test']; $result = rcmail_sendmail::draftinfo_encode($input); - $this->assertEquals('folder=B::dGVzdA==', $result); - $this->assertEquals($input, rcmail_sendmail::draftinfo_decode($result)); + $this->assertSame('folder=B::dGVzdA==', $result); + $this->assertSame($input, rcmail_sendmail::draftinfo_decode($result)); $input = ['test' => 'test;test']; $result = rcmail_sendmail::draftinfo_encode($input); - $this->assertEquals('test=B::dGVzdDt0ZXN0', $result); - $this->assertEquals($input, rcmail_sendmail::draftinfo_decode($result)); + $this->assertSame('test=B::dGVzdDt0ZXN0', $result); + $this->assertSame($input, rcmail_sendmail::draftinfo_decode($result)); $input = ['test' => 'test;test', 'a' => 'b']; $result = rcmail_sendmail::draftinfo_encode($input); - $this->assertEquals('test=B::dGVzdDt0ZXN0; a=b', $result); - $this->assertEquals($input, rcmail_sendmail::draftinfo_decode($result)); + $this->assertSame('test=B::dGVzdDt0ZXN0; a=b', $result); + $this->assertSame($input, rcmail_sendmail::draftinfo_decode($result)); } /**