Skip to content

Commit

Permalink
fix "php_unit_strict"
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 17, 2023
1 parent 8ed4c5e commit 886bf49
Show file tree
Hide file tree
Showing 21 changed files with 148 additions and 148 deletions.
4 changes: 2 additions & 2 deletions plugins/managesieve/tests/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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));
}
}
14 changes: 7 additions & 7 deletions plugins/password/tests/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Browser/Mail/GetunreadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
}
}
2 changes: 1 addition & 1 deletion tests/Browser/Mail/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/Browser/Settings/Preferences/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
18 changes: 9 additions & 9 deletions tests/Framework/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

}
Expand All @@ -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");
}

}
Expand All @@ -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");
}

}
Expand All @@ -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");
}

/**
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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");
}
}

Expand All @@ -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()");
}

}
Expand Down Expand Up @@ -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'));
}
}
22 changes: 11 additions & 11 deletions tests/Framework/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand All @@ -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');

}

Expand All @@ -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()
Expand Down
16 changes: 8 additions & 8 deletions tests/Framework/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down Expand Up @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
}
8 changes: 4 additions & 4 deletions tests/Framework/Csv2vcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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);
}
}
6 changes: 3 additions & 3 deletions tests/Framework/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -87,7 +87,7 @@ function data_quote()
*/
function test_quote($str, $expected)
{
$this->assertEquals($expected, html::quote($str));
$this->assertSame($expected, html::quote($str));
}

/**
Expand Down Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion tests/Framework/Html2text.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Loading

0 comments on commit 886bf49

Please sign in to comment.