[feature/module_services] Add tests that check if errors appear on portal
This commit is contained in:
@@ -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,
|
||||
|
||||
41
tests/functional/portal_no_error_test.php
Normal file
41
tests/functional/portal_no_error_test.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 Board3 Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
*/
|
||||
class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testframework\functional_test_case
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user