[ticket/555] Fix tests
B3P-555
This commit is contained in:
@@ -86,7 +86,6 @@ class modules_helper
|
||||
{
|
||||
// Build options
|
||||
$options = '<select id="' . $key . '" name="' . $key;
|
||||
var_dump($selected_options, sizeof($selected_options));
|
||||
$options .= (sizeof($selected_options) > 1) ? '[]" multiple="multiple">' : '">';
|
||||
foreach ($select_ary as $id => $option)
|
||||
{
|
||||
@@ -115,6 +114,11 @@ class modules_helper
|
||||
{
|
||||
$selected_options = explode(',', $this->config[$key]);
|
||||
}
|
||||
// Add useless values to force multi drop down list
|
||||
$selected_options += array(
|
||||
'-1' => '',
|
||||
'-2' => '',
|
||||
);
|
||||
|
||||
// Build forum options
|
||||
foreach ($forum_list as $f_id => $f_row)
|
||||
|
||||
@@ -45,16 +45,22 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
->getMock());
|
||||
// Mock module service collection
|
||||
$config = new \phpbb\config\config(array());
|
||||
$auth = $this->getMock('\phpbb\auth\auth', array('acl_get'));
|
||||
$auth->expects($this->any())
|
||||
->method('acl_get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(true));
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, new \phpbb_mock_request);
|
||||
$phpbb_container->set('board3.portal.module_collection',
|
||||
array(
|
||||
new \board3\portal\modules\clock($config, $template),
|
||||
new \board3\portal\modules\birthday_list($config, $template, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx),
|
||||
new \board3\portal\modules\donation($config, $template, $user),
|
||||
new \board3\portal\modules\donation($config, new \phpbb_mock_request, $template, $user, $modules_helper),
|
||||
));
|
||||
$this->portal_helper = new \board3\portal\includes\helper($phpbb_container->get('board3.portal.module_collection'));
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$phpbb_container->set('board3.portal.helper', $this->portal_helper);
|
||||
$phpbb_container->set('board3.portal.modules_helper', new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), $config, $controller_helper, $request));
|
||||
$phpbb_container->setParameter('board3.portal.modules.table', $table_prefix . 'portal_modules');
|
||||
@@ -120,11 +126,6 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
'\board3\portal\modules\clock' => new \board3\portal\modules\clock($config, $template),
|
||||
);
|
||||
$portal_helper = new \board3\portal\includes\helper($modules);
|
||||
$auth = $this->getMock('\phpbb\auth\auth', array('acl_get'));
|
||||
$auth->expects($this->any())
|
||||
->method('acl_get')
|
||||
->with($this->anything())
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$controller_helper = new \board3\portal\controller\helper(
|
||||
$auth,
|
||||
|
||||
@@ -55,7 +55,7 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
public function data_generate_select_box()
|
||||
{
|
||||
return array(
|
||||
array('<select id="foobar" name="foobar[]" multiple="multiple"><option value="one">one</option><option value="two" selected="selected">two</option></select>',
|
||||
array('<select id="foobar" name="foobar"><option value="one">one</option><option value="two" selected="selected">two</option></select>',
|
||||
'foobar',
|
||||
array(
|
||||
'1' => array(
|
||||
@@ -68,7 +68,7 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
),
|
||||
),
|
||||
array('two')),
|
||||
array('<select id="foobar" name="foobar[]" multiple="multiple"><option value="one" selected="selected">two</option><option value="two">three</option></select>',
|
||||
array('<select id="foobar" name="foobar"><option value="one" selected="selected">two</option><option value="two">three</option></select>',
|
||||
'foobar',
|
||||
array(
|
||||
'1' => array(
|
||||
@@ -81,6 +81,19 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
),
|
||||
),
|
||||
array('one')),
|
||||
array('<select id="foobar" name="foobar[]" multiple="multiple"><option value="one" selected="selected">two</option><option value="two" selected="selected">three</option></select>',
|
||||
'foobar',
|
||||
array(
|
||||
'1' => array(
|
||||
'value' => 'one',
|
||||
'title' => 'two',
|
||||
),
|
||||
'2' => array(
|
||||
'value' => 'two',
|
||||
'title' => 'three',
|
||||
),
|
||||
),
|
||||
array('one', 'two')),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,14 +47,19 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
$request =new \phpbb_mock_request();
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
$auth = new \phpbb\auth\auth();
|
||||
|
||||
$config = new \phpbb\config\config(array());
|
||||
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $this->request);
|
||||
|
||||
$this->portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
new \board3\portal\modules\birthday_list($config, null, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $this->phpbb_root_path, $this->phpEx),
|
||||
new \board3\portal\modules\donation($config, null, $user),
|
||||
new \board3\portal\modules\donation($config, $this->request, null, $user, $modules_helper),
|
||||
));
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
|
||||
@@ -41,12 +41,17 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
$request =new \phpbb_mock_request();
|
||||
|
||||
$config = new \phpbb\config\config(array());
|
||||
$auth = new \phpbb\auth\auth();
|
||||
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $this->request);
|
||||
|
||||
$portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
new \board3\portal\modules\birthday_list($config, null, $this->db, $user),
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $this->phpbb_root_path, $this->phpEx),
|
||||
new \board3\portal\modules\donation($config, null, $user),
|
||||
new \board3\portal\modules\donation($config, $request, null, $user, $modules_helper),
|
||||
));
|
||||
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
|
||||
Reference in New Issue
Block a user