From eedadad02d4b5292d7e1af66b63d8e440c600de7 Mon Sep 17 00:00:00 2001 From: Alvin Bauma Date: Tue, 6 Feb 2024 13:29:15 +0200 Subject: [PATCH] Fix failed unit tests --- language/fa.php | 2 +- modules/2fa/modules.php | 18 +-- modules/2fa/site.css | 4 - modules/smtp/modules.php | 4 +- .../modules/core/message_list_functions.php | 20 +-- tests/phpunit/modules/core/modules.php | 136 +++++++++--------- 6 files changed, 83 insertions(+), 101 deletions(-) diff --git a/language/fa.php b/language/fa.php index 3feb7cdbc6..71c9a8095a 100755 --- a/language/fa.php +++ b/language/fa.php @@ -249,7 +249,7 @@ "Github Connect"=>"Github Connect", "Hide From Combined Pages"=>"پنهان کردن از صفحات ترکیبی", "Save Settings"=>"تنظیمات را ذخیره کن", - "Settings are not saved permanently on the server unless you explicitly allow it. If you don't save your settings, any changes made since you last logged in will be deleted when your session expires or you logout. You must re-enter your password for security purposes to save your settings permanently."=>"تنظیمات برای همیشه در سرور ذخیره نمی شوند ، مگر اینکه صریحاً اجازه آن را بدهید. اگر تنظیمات خود را ذخیره نکنید ، با اتمام جلسه یا خارج شدن از سیستم ، هر تغییری که از آخرین ورود به سیستم انجام داده اید ، حذف خواهد شد. برای ذخیره تنظیمات خود باید دوباره رمز ورود خود را برای اهداف امنیتی وارد کنید.", + "Settings are not saved permanently on the server unless you explicitly allow it. If you don\'t save your settings, any changes made since you last logged in will be deleted when your session expires or you logout. You must re-enter your password for security purposes to save your settings permanently."=>"تنظیمات برای همیشه در سرور ذخیره نمی شوند ، مگر اینکه صریحاً اجازه آن را بدهید. اگر تنظیمات خود را ذخیره نکنید ، با اتمام جلسه یا خارج شدن از سیستم ، هر تغییری که از آخرین ورود به سیستم انجام داده اید ، حذف خواهد شد. برای ذخیره تنظیمات خود باید دوباره رمز ورود خود را برای اهداف امنیتی وارد کنید.", "Add a Repository"=>"مخزن اضافه کنید", "Disconnect"=>"قطع شدن", "Already connected"=>"قبلاً متصل شده اید", diff --git a/modules/2fa/modules.php b/modules/2fa/modules.php index ca0d15bb18..21750235bb 100644 --- a/modules/2fa/modules.php +++ b/modules/2fa/modules.php @@ -147,19 +147,6 @@ protected function output() { if (array_key_exists('2fa_enable', $settings)) { $enabled = $settings['2fa_enable']; } -<<<<<<< HEAD - $res = ' - '. - ''.$this->trans('2 Factor Authentication').' - - '; - - $res .= ' - - '.$this->trans('Enable 2 factor authentication').' - '; - -======= $res = ''. ''.$this->trans('2 Factor Authentication').''; @@ -169,7 +156,6 @@ protected function output() { $res .= ' checked="checked"'; } $res .= '>'; ->>>>>>> ba2058f0 (2fa Module) $svg = $this->get('2fa_svg'); if ($svg) { @@ -196,7 +182,7 @@ protected function output() { $res .= ' '.$val.'
'; } $res .= '
-
+
Enter the confirmation code
@@ -208,7 +194,7 @@ protected function output() {
- +
'.$this->trans('Enter the 6 digit code from your Authenticator application').'
diff --git a/modules/2fa/site.css b/modules/2fa/site.css index c98a6077f1..899b8eaef8 100644 --- a/modules/2fa/site.css +++ b/modules/2fa/site.css @@ -1,4 +1,3 @@ -<<<<<<< HEAD :root { --tfa-form-valid-color: #198754; --tfa-form-valid-border-color: #198754; @@ -218,6 +217,3 @@ /** ** Shake Annimation Ends Here. **/ -======= -.tfa_setting { display: none; } ->>>>>>> ba2058f0 (2fa Module) diff --git a/modules/smtp/modules.php b/modules/smtp/modules.php index 3afb701f75..00f728007c 100644 --- a/modules/smtp/modules.php +++ b/modules/smtp/modules.php @@ -1131,11 +1131,11 @@ protected function output() { ''. ''. ''. - '
'. + '
'. ''. ''. '
'. - '
'; + '
'; if ($html == 2) { $res .= ''. ''. diff --git a/tests/phpunit/modules/core/message_list_functions.php b/tests/phpunit/modules/core/message_list_functions.php index 9bd6c2adf7..5dc21c0fdc 100644 --- a/tests/phpunit/modules/core/message_list_functions.php +++ b/tests/phpunit/modules/core/message_list_functions.php @@ -29,9 +29,9 @@ public function test_get_message_list_settings() { public function test_get_message_list_meta() { $mod = new Hm_Output_Test(array('foo' => 'bar', 'bar' => 'foo'), array('bar')); $this->assertEquals('', message_list_meta(array(), $mod)); - $this->assertEquals('
last 7 days- sources@20 each- total
', message_list_meta(array('list_meta' => 'foo', 'message_list_since' => '-1 week'), $mod)); - $this->assertEquals('
last 7 days- sources@5 each- total
', message_list_meta(array('list_meta' => 'foo', 'per_source_limit' => 5), $mod)); - $this->assertEquals('
last 7 days- sources@5 each- total
', message_list_meta(array('list_meta' => 'foo', 'per_source_limit' => 5, 'message_list_since' => '-1 week'), $mod)); + $this->assertEquals('
last 7 days- sources@20 each- total
', message_list_meta(array('list_meta' => 'foo', 'message_list_since' => '-1 week'), $mod)); + $this->assertEquals('
last 7 days- sources@5 each- total
', message_list_meta(array('list_meta' => 'foo', 'per_source_limit' => 5), $mod)); + $this->assertEquals('
last 7 days- sources@5 each- total
', message_list_meta(array('list_meta' => 'foo', 'per_source_limit' => 5, 'message_list_since' => '-1 week'), $mod)); } /** * @preserveGlobalState disabled @@ -107,7 +107,7 @@ public function test_icon_callback() { */ public function test_message_controls() { $mod = new Hm_Output_Test(array('msg_controls_extra' => 'foo', 'foo' => 'bar', 'bar' => 'foo'), array('bar')); - $this->assertEquals('x', message_controls($mod)); + $this->assertEquals('', message_controls($mod)); } /** * @preserveGlobalState disabled @@ -115,7 +115,7 @@ public function test_message_controls() { */ public function test_message_since_dropdown() { $mod = new Hm_Output_Test(array('foo' => 'bar', 'bar' => 'foo'), array('bar')); - $this->assertEquals('', message_since_dropdown('-1 week', 'foo', $mod)); + $this->assertEquals('', message_since_dropdown('-1 week', 'foo', $mod)); } /** * @preserveGlobalState disabled @@ -160,18 +160,18 @@ public function test_validate_search_field() { */ public function test_search_field_selection() { $mod = new Hm_Output_Test(array('foo' => 'bar', 'bar' => 'foo'), array('bar')); - $this->assertEquals('', search_field_selection('TEXT', $mod)); - $this->assertEquals('', search_field_selection('foo', $mod)); + $this->assertEquals('', search_field_selection('TEXT', $mod)); + $this->assertEquals('', search_field_selection('foo', $mod)); } /** * @preserveGlobalState disabled * @runInSeparateProcess */ public function test_build_page_links() { - $this->assertEquals('← 1 2 3 4 5 6 7 8 9 10 11 ... 100 →', build_page_links(10, 5, 1000, '/')); - $this->assertEquals('← 1 ... 4 5 6 7 8 9 10 11 12 13 14 ... 100 →', build_page_links(10, 10, 1000, '/')); + $this->assertEquals(' 1 2 3 4 5 6 7 8 9 10 11 ... 100 ', build_page_links(10, 5, 1000, '/')); + $this->assertEquals(' 1 ... 4 5 6 7 8 9 10 11 12 13 14 ... 100 ', build_page_links(10, 10, 1000, '/')); $this->assertEquals('', build_page_links(10, 1, 10, '/')); - $this->assertEquals('← 1 2 3 4 5 6 7 8 9 10 →', build_page_links(10, 1, 100, '/', true, true)); + $this->assertEquals(' 1 2 3 4 5 6 7 8 9 10 ', build_page_links(10, 1, 100, '/', true, true)); $this->assertEquals('← 1 2 3 →', build_page_links(10, 1, 30, '/', true, true, "cypht")); } } diff --git a/tests/phpunit/modules/core/modules.php b/tests/phpunit/modules/core/modules.php index 871fc2a06c..cfaceeffd6 100644 --- a/tests/phpunit/modules/core/modules.php +++ b/tests/phpunit/modules/core/modules.php @@ -567,7 +567,7 @@ public function test_search_from_folder_list() { $test->run(); $test->rtype = 'AJAX'; $res = $test->run(); - $this->assertEquals('', $res->output_data['formatted_folder_list']); + $this->assertEquals('', $res->output_data['formatted_folder_list']); } /** * @preserveGlobalState disabled @@ -576,7 +576,7 @@ public function test_search_from_folder_list() { public function test_search_content_start() { $test = new Output_Test('search_content_start', 'core'); $res = $test->run(); - $this->assertEquals(array('
xSearch'), $res->output_response); + $this->assertEquals(array('
Search'), $res->output_response); } /** * @preserveGlobalState disabled @@ -609,7 +609,7 @@ public function test_save_reminder() { public function test_search_form_start() { $test = new Output_Test('search_form_start', 'core'); $res = $test->run(); - $this->assertEquals(array('
'), $res->output_response); + $this->assertEquals(array('
'), $res->output_response); } /** * @preserveGlobalState disabled @@ -618,7 +618,7 @@ public function test_search_form_start() { public function test_search_form_content() { $test = new Output_Test('search_form_content', 'core'); $res = $test->run(); - $this->assertEquals(array(' | '), $res->output_response); + $this->assertEquals(array(' | '), $res->output_response); } /** * @preserveGlobalState disabled @@ -677,7 +677,7 @@ public function test_fancy_login_end() { public function test_login_start() { $test = new Output_Test('login_start', 'core'); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); $test->handler_response = array('router_login_state' => true); $res = $test->run(); $this->assertEquals(array(''), $res->output_response); @@ -765,7 +765,7 @@ public function test_msgs() { $test = new Output_Test('msgs', 'core'); $test->handler_response = array('router_login_state' => false); $res = $test->run(); - $this->assertEquals(array('
foo,foo
'), $res->output_response); + $this->assertEquals(array('
'), $res->output_response); } /** * @preserveGlobalState disabled @@ -774,7 +774,7 @@ public function test_msgs() { public function test_header_start() { $test = new Output_Test('header_start', 'core'); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); } /** * @preserveGlobalState disabled @@ -828,7 +828,7 @@ public function test_header_content() { public function test_header_css() { $test = new Output_Test('header_css', 'core'); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); } /** * @preserveGlobalState disabled @@ -839,7 +839,7 @@ public function test_header_css_integrity() { $test = new Output_Test('header_css', 'core'); $test->handler_response = array('router_module_list', array('core')); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); } /** * @preserveGlobalState disabled @@ -898,7 +898,7 @@ public function test_loading_icon() { public function test_start_settings_form() { $test = new Output_Test('start_settings_form', 'core'); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array('
'), $res->output_response); $test->handler_response = array('single_server_mode' => true); $res = $test->run(); - $this->assertEquals(array('
'), $res->output_response); + $this->assertEquals(array('
'), $res->output_response); } /** * @preserveGlobalState disabled @@ -1225,10 +1225,10 @@ public function test_main_menu_content() { $test = new Output_Test('main_menu_content', 'core'); $test->handler_response = array('folder_sources' => array(array('email_folders', 'baz'))); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); $test->rtype = 'AJAX'; $res = $test->run(); - $this->assertEquals(array('folder_sources' => array(array('email_folders', 'baz')), 'formatted_folder_list' => ''), $res->output_response); + $this->assertEquals(array('folder_sources' => array(array('email_folders', 'baz')), 'formatted_folder_list' => ''), $res->output_response); } /** * @preserveGlobalState disabled @@ -1237,10 +1237,10 @@ public function test_main_menu_content() { public function test_logout_menu_item() { $test = new Output_Test('logout_menu_item', 'core'); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); $test->rtype = 'AJAX'; $res = $test->run(); - $this->assertEquals(array('formatted_folder_list' => ''), $res->output_response); + $this->assertEquals(array('formatted_folder_list' => ''), $res->output_response); } /** * @preserveGlobalState disabled @@ -1265,10 +1265,10 @@ public function test_email_menu_content() { $this->assertEquals(array(''), $res->output_response); $test->handler_response = array('folder_sources' => array(array('email_folders', 'baz'))); $res = $test->run(); - $this->assertEquals(array('
Email
'), $res->output_response); + $this->assertEquals(array('
Email
'), $res->output_response); $test->rtype = 'AJAX'; $res = $test->run(); - $this->assertEquals(array('folder_sources' => array(array('email_folders', 'baz')), 'formatted_folder_list' => '
Email
'), $res->output_response); + $this->assertEquals(array('folder_sources' => array(array('email_folders', 'baz')), 'formatted_folder_list' => '
Email
'), $res->output_response); } /** * @preserveGlobalState disabled @@ -1277,10 +1277,10 @@ public function test_email_menu_content() { public function test_settings_menu_start() { $test = new Output_Test('settings_menu_start', 'core'); $res = $test->run(); - $this->assertEquals(array('
Settings
'), $res->output_response); } /** * @preserveGlobalState disabled @@ -1434,10 +1434,10 @@ public function test_message_list_start() { $test = new Output_Test('message_list_start', 'core'); $test->handler_response = array('message_list_fields' => array('foo', 'bar')); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array('
or
'), $res->output_response); $test->handler_response = array('message_list_fields' => array(array(false, true, false))); $res = $test->run(); - $this->assertEquals(array('
or
'), $res->output_response); + $this->assertEquals(array('
'), $res->output_response); } /** * @preserveGlobalState disabled @@ -1502,7 +1502,7 @@ public function test_message_list_heading() { public function test_message_list_end() { $test = new Output_Test('message_list_end', 'core'); $res = $test->run(); - $this->assertEquals(array('
'), $res->output_response); + $this->assertEquals(array('
'), $res->output_response); } } class Hm_Test_Core_Output_Modules_Debug extends TestCase { @@ -1520,7 +1520,7 @@ public function test_header_css_debug() { $test = new Output_Test('header_css', 'core'); $test->handler_response = array('router_module_list' => array('core')); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); } /** * @preserveGlobalState disabled @@ -1530,10 +1530,10 @@ public function test_page_js_debug() { $test = new Output_Test('page_js', 'core'); $test->handler_response = array('encrypt_ajax_requests' => true, 'router_module_list' => array('foo', 'core')); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); $test->handler_response = array('encrypt_ajax_requests' => true, 'router_module_list' => array('imap')); $res = $test->run(); - $this->assertEquals(array(''), $res->output_response); + $this->assertEquals(array(''), $res->output_response); } /** * @preserveGlobalState disabled