diff --git a/portal/modules/portal_poll.php b/portal/modules/portal_poll.php index 2ee75102..1c4cb909 100644 --- a/portal/modules/portal_poll.php +++ b/portal/modules/portal_poll.php @@ -468,7 +468,7 @@ class portal_poll_module extends \board3\portal\modules\module_base 'POLL_LENGTH' => $data['poll_length'], 'TOPIC_ID' => $topic_id, 'TOTAL_VOTES' => $poll_total_votes, - 'L_MAX_VOTES' => ($data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $data['poll_max_options']), + 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', $data['poll_max_options']), 'L_POLL_LENGTH' => ($data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', 'S_CAN_VOTE' => $s_can_vote, 'S_DISPLAY_RESULTS' => $s_display_results, diff --git a/tests/functional/portal_no_error_test.php b/tests/functional/portal_no_error_test.php new file mode 100644 index 00000000..d3fce5a8 --- /dev/null +++ b/tests/functional/portal_no_error_test.php @@ -0,0 +1,41 @@ +login(); + $this->admin_login(); + $this->enable_board3_portal_ext(); + } + + public function test_vanilla_board() + { + $crawler = self::request('GET', 'app.php/portal'); + } + + public function test_with_poll() + { + // Create topic with poll + $data = $this->create_topic(2, 'Portal-poll', 'This is a poll for the portal', array( + 'poll_title' => 'Is this a poll?', + 'poll_option_text' => "Yes\nNo\nMaybe", + )); + + if (isset($data)) + { + $crawler = self::request('GET', 'app.php/portal'); + } + } +} diff --git a/tests/functional/portal_redirect_test.php b/tests/functional/portal_redirect_test.php index a667c130..8aa82b64 100644 --- a/tests/functional/portal_redirect_test.php +++ b/tests/functional/portal_redirect_test.php @@ -20,28 +20,6 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra $this->enable_board3_portal_ext(); } - protected function enable_board3_portal_ext() - { - $enable_portal = false; - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); - $disabled_extensions = $crawler->filter('tr.ext_disabled')->extract(array('_text')); - foreach ($disabled_extensions as $extension) - { - if (strpos($extension, 'Board3 Portal') !== false) - { - $enable_portal = true; - } - } - - if ($enable_portal) - { - $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=board3%2fportal&sid=' . $this->sid); - $form = $crawler->selectButton('Enable')->form(); - $crawler = self::submit($form); - $this->assertContains('The extension was enabled successfully', $crawler->text()); - } - } - public function test_redirect() { if (function_exists('apache_get_modules')) @@ -51,7 +29,7 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra } else { - $mod_rewrite = (getenv('HTTP_MOD_REWRITE')=='On') ? true : false; + $mod_rewrite = (getenv('HTTP_MOD_REWRITE')=='On') ? true : false; } if ($mod_rewrite) diff --git a/tests/testframework/functional_test_case.php b/tests/testframework/functional_test_case.php index 36058aee..09d3037d 100644 --- a/tests/testframework/functional_test_case.php +++ b/tests/testframework/functional_test_case.php @@ -11,4 +11,34 @@ namespace board3\portal\tests\testframework; abstract class functional_test_case extends \phpbb_functional_test_case { + protected $portal_enabled = false; + + public function enable_board3_portal_ext() + { + $enable_portal = false; + + if ($this->portal_enabled === true) + { + return; + } + + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); + $disabled_extensions = $crawler->filter('tr.ext_disabled')->extract(array('_text')); + foreach ($disabled_extensions as $extension) + { + if (strpos($extension, 'Board3 Portal') !== false) + { + $enable_portal = true; + } + } + + if ($enable_portal) + { + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=board3%2fportal&sid=' . $this->sid); + $form = $crawler->selectButton('Enable')->form(); + $crawler = self::submit($form); + $this->assertContains('The extension was enabled successfully', $crawler->text()); + $this->portal_enabled = true; + } + } }