[ticket/469] Fix tests with new settings

B3P-469
This commit is contained in:
Marc Alexander
2015-02-13 19:52:00 +01:00
parent 311c7cb97f
commit 30bd67f3d8
3 changed files with 24 additions and 3 deletions

View File

@@ -104,7 +104,7 @@ class portal_module
'legend3' => 'ACP_PORTAL_SHOW_ALL',
'board3_show_all_pages' => array('lang' => 'ACP_PORTAL_SHOW_ALL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_show_all_side' => array('lang' => 'PORTAL_SHOW_ALL_SIDE', 'validate' => 'bool', 'type' => 'custom', 'method' => array('board3.portal.modules_helper', 'display_left_right'), 'explain' => true),
'board3_show_all_side' => array('lang' => 'PORTAL_SHOW_ALL_SIDE', 'validate' => 'bool', 'type' => 'custom', 'method' => array('board3.portal.modules_helper', 'display_left_right'), 'submit' => array('board3.portal.modules_helper', 'store_left_right'), 'explain' => true),
)
);
@@ -223,11 +223,11 @@ class portal_module
if ($null['submit'][0] == 'board3.portal.modules_helper')
{
$func = array($this->modules_helper, $null['submit'][1]);
$args = ($module_id != 0) ? array($config_name, $module_id) : $config_name;
$args = ($module_id != 0) ? array($config_name, $module_id) : array($config_name);
}
else
{
$args = ($module_id != 0) ? array($cfg_array[$config_name], $config_name, $module_id) : $config_name;
$args = ($module_id != 0) ? array($cfg_array[$config_name], $config_name, $module_id) : array($config_name);
$func = $null['submit'];
}
}

View File

@@ -173,4 +173,17 @@ class modules_helper
return h_radio($key, $radio_ary, $value, $key);
}
/**
* Store left right choice
*
* @param string $key Config key
*/
public function store_left_right($key)
{
// Get selected side
$value = $this->request->variable($key, false);
$this->config->set($key, $value);
}
}

View File

@@ -17,6 +17,9 @@ class listener_test extends \phpbb_template_template_test_case
protected $listener;
protected $auth;
/** @var \board3\portal\controller\main */
protected $controller;
static public $hidden_fields = array();
public function setup()
@@ -91,7 +94,12 @@ class listener_test extends \phpbb_template_template_test_case
$this->auth->acl_options['global']['u_view_portal'] = 0;
$this->auth->acl[0][0] = true;
$this->controller = $this->getMockBuilder('\board3\portal\controller\main')
->disableOriginalConstructor()
->getMock();
$this->listener = new \board3\portal\event\listener(
$this->controller,
$this->auth,
$this->config,
$this->controller_helper,