diff --git a/tests/Actions/Mail/Index.php b/tests/Actions/Mail/Index.php index 7e8c36059..7fc023fd7 100644 --- a/tests/Actions/Mail/Index.php +++ b/tests/Actions/Mail/Index.php @@ -1,629 +1,629 @@ initOutput(rcmail_action::MODE_HTTP, 'mail', ''); $this->assertInstanceOf('rcmail_action', $action); $this->assertTrue($action->checks()); $_GET = ['_uid' => 10]; // Set expected storage function calls/results rcmail::get_instance()->storage ->registerFunction('set_options') ->registerFunction('get_pagesize', 10) ->registerFunction('set_charset') ->registerFunction('is_connected', true) ->registerFunction('set_folder') ->registerFunction('get_folder', 'INBOX') ->registerFunction('get_folder', 'INBOX') ->registerFunction('get_threading', false) ->registerFunction('get_pagesize', 10) ->registerFunction('get_capability', false) ->registerFunction('get_capability', false) ->registerFunction('set_folder') ->registerFunction('set_page') ->registerFunction('set_threading'); $action->run(); $this->assertSame([], $output->headers); $this->assertNull($output->getOutput()); $this->assertSame('Inbox', $output->getProperty('pagetitle')); $this->assertSame('INBOX', $output->get_env('mailbox')); $this->assertSame(10, $output->get_env('pagesize')); $this->assertSame('/', $output->get_env('delimiter')); $this->assertSame('widescreen', $output->get_env('layout')); $this->assertSame('Drafts', $output->get_env('drafts_mailbox')); $this->assertSame('Trash', $output->get_env('trash_mailbox')); $this->assertSame('Junk', $output->get_env('junk_mailbox')); $this->assertSame(10, $output->get_env('list_uid')); } /** * Test run() method in AJAX mode */ function test_run_ajax() { $action = new rcmail_action_mail_index; $output = $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'list'); $this->assertTrue($action->checks()); // Set expected storage function calls/results rcmail::get_instance()->storage ->registerFunction('set_options') ->registerFunction('get_pagesize') ->registerFunction('set_charset') ->registerFunction('is_connected', true) ->registerFunction('set_folder') ->registerFunction('get_folder', 'INBOX') ->registerFunction('get_threading', false) ->registerFunction('get_pagesize') ->registerFunction('get_capability', false) ->registerFunction('get_capability', false) ->registerFunction('set_folder') ->registerFunction('set_page') ->registerFunction('set_threading'); $action->run(); $this->assertSame([], $output->headers); $this->assertNull($output->getOutput()); $this->assertSame('', $output->getProperty('pagetitle')); $this->assertSame('INBOX', $output->get_env('mailbox')); $this->assertSame(10, $output->get_env('pagesize')); $this->assertSame(1, $output->get_env('current_page')); $this->assertSame('/', $output->get_env('delimiter')); $this->assertSame('widescreen', $output->get_env('layout')); $this->assertSame('Drafts', $output->get_env('drafts_mailbox')); $this->assertSame('Trash', $output->get_env('trash_mailbox')); $this->assertSame('Junk', $output->get_env('junk_mailbox')); } /** * Test message_list_smart_column_name() method */ function test_message_list_smart_column_name() { $action = new rcmail_action_mail_index; $output = $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'list'); $output->set_env('mailbox', 'INBOX'); $this->assertSame('from', $action->message_list_smart_column_name()); $output->set_env('mailbox', 'Drafts'); $this->assertSame('to', $action->message_list_smart_column_name()); $output->set_env('mailbox', 'Drafts/Subfolder'); $this->assertSame('to', $action->message_list_smart_column_name()); $output->set_env('mailbox', 'Sent'); $this->assertSame('to', $action->message_list_smart_column_name()); $output->set_env('mailbox', 'Sent/Subfolder'); $this->assertSame('to', $action->message_list_smart_column_name()); } /** * Test message_list() method */ function test_message_list() { $action = new rcmail_action_mail_index; $output = $this->initOutput(rcmail_action::MODE_HTTP, 'mail', 'list'); rcmail::get_instance()->storage->registerFunction('get_folder', 'INBOX'); $result = $action->message_list([]); $this->assertRegExp('/^