[ticket/289] Move store_selected_forums to modules_helper
This commit is contained in:
@@ -182,20 +182,28 @@ class portal_module
|
|||||||
{
|
{
|
||||||
if ($submit && ((isset($null['type']) && $null['type'] == 'custom') || (isset($null['submit_type']) && $null['submit_type'] == 'custom')))
|
if ($submit && ((isset($null['type']) && $null['type'] == 'custom') || (isset($null['submit_type']) && $null['submit_type'] == 'custom')))
|
||||||
{
|
{
|
||||||
$func = array($this->c_class, $null['submit']);
|
if (!is_array($null['submit']))
|
||||||
|
|
||||||
if(method_exists($this->c_class, $null['submit']))
|
|
||||||
{
|
{
|
||||||
|
$func = array($this->c_class, $null['submit']);
|
||||||
|
$args = ($module_id != 0) ? array($config_name, $module_id) : $config_name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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) : $config_name;
|
||||||
call_user_func_array($func, $args);
|
|
||||||
}
|
}
|
||||||
else
|
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) : $config_name;
|
||||||
call_user_func_array($null['submit'], $args);
|
$func = $null['submit'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
call_user_func_array($func, $args);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
|
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
- @auth
|
- @auth
|
||||||
- @config
|
- @config
|
||||||
|
- @request
|
||||||
|
|
||||||
board3.portal.fetch_posts:
|
board3.portal.fetch_posts:
|
||||||
class: board3\portal\portal\fetch_posts
|
class: board3\portal\portal\fetch_posts
|
||||||
|
|||||||
@@ -23,17 +23,25 @@ class modules_helper
|
|||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phpBB request
|
||||||
|
* @var \phpbb\request\request
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* NOTE: The parameters of this method must match in order and type with
|
* NOTE: The parameters of this method must match in order and type with
|
||||||
* the dependencies defined in the services.yml file for this service.
|
* the dependencies defined in the services.yml file for this service.
|
||||||
* @param \phpbb\auth\auth $auth Auth object
|
* @param \phpbb\auth\auth $auth Auth object
|
||||||
* @param \phpbb\config\config $config phpBB config
|
* @param \phpbb\config\config $config phpBB config
|
||||||
|
* @param \phpbb\request\request $request phpBB request
|
||||||
*/
|
*/
|
||||||
public function __construct($auth, $config)
|
public function __construct($auth, $config, $request)
|
||||||
{
|
{
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
$this->request = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,4 +119,21 @@ class modules_helper
|
|||||||
|
|
||||||
return $this->generate_select_box($key, $select_ary, $selected_options);
|
return $this->generate_select_box($key, $select_ary, $selected_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store selected forums
|
||||||
|
*
|
||||||
|
* @param string $key Key name
|
||||||
|
* @param int $module_id Module ID
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function store_selected_forums($key)
|
||||||
|
{
|
||||||
|
// Get selected extensions
|
||||||
|
$values = $this->request->variable($key, array(0 => ''));
|
||||||
|
$news = implode(',', $values);
|
||||||
|
$this->config->set($key, $news);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ class announcements extends module_base
|
|||||||
'board3_number_of_announcements_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_number_of_announcements_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_announcements_day_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_announcements_day_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_announcements_length_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_announcements_length_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_global_announcements_forum_' . $module_id => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => 'store_selected_forums'),
|
'board3_global_announcements_forum_' . $module_id => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
|
||||||
'board3_announcements_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_FORUM_EXCLUDE', 'validate' => 'string', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_announcements_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_FORUM_EXCLUDE', 'validate' => 'string', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_announcements_archive_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_announcements_archive_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_announcements_permissions_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_announcements_permissions_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
@@ -504,20 +504,4 @@ class announcements extends module_base
|
|||||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
return $db->sql_query($sql);
|
return $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store selected forums
|
|
||||||
*
|
|
||||||
* @param string $key Key name
|
|
||||||
* @param int $module_id Module ID
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function store_selected_forums($key, $module_id)
|
|
||||||
{
|
|
||||||
// Get selected forums
|
|
||||||
$values = $this->request->variable($key, array(0 => ''));
|
|
||||||
$news = implode(',', $values);
|
|
||||||
set_config($key, $news);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class attachments extends module_base
|
|||||||
'legend1' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
|
'legend1' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
|
||||||
'board3_attachments_number_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_attachments_number_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_attach_max_length_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_MAX_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_attach_max_length_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_MAX_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_attachments_forum_ids_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_IDS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => 'store_selected_forums'),
|
'board3_attachments_forum_ids_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_IDS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
|
||||||
'board3_attachments_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_attachments_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_attachments_filetype_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FILETYPE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_filetype', 'submit' => 'store_filetypes'),
|
'board3_attachments_filetype_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FILETYPE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_filetype', 'submit' => 'store_filetypes'),
|
||||||
'board3_attachments_exclude_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_attachments_exclude_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
@@ -212,22 +212,6 @@ class attachments extends module_base
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store selected forums
|
|
||||||
*
|
|
||||||
* @param string $key Key name
|
|
||||||
* @param int $module_id Module ID
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function store_selected_forums($key)
|
|
||||||
{
|
|
||||||
// Get selected extensions
|
|
||||||
$values = $this->request->variable($key, array(0 => ''));
|
|
||||||
$news = implode(',', $values);
|
|
||||||
set_config($key, $news);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse template variables for module
|
* Parse template variables for module
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ class news extends module_base
|
|||||||
'board3_show_all_news_' . $module_id => array('lang' => 'PORTAL_SHOW_ALL_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_show_all_news_' . $module_id => array('lang' => 'PORTAL_SHOW_ALL_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_number_of_news_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_NEWS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_number_of_news_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_NEWS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_news_length_' . $module_id => array('lang' => 'PORTAL_NEWS_LENGTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_news_length_' . $module_id => array('lang' => 'PORTAL_NEWS_LENGTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_news_forum_' . $module_id => array('lang' => 'PORTAL_NEWS_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => 'store_selected_forums'),
|
'board3_news_forum_' . $module_id => array('lang' => 'PORTAL_NEWS_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
|
||||||
'board3_news_exclude_' . $module_id => array('lang' => 'PORTAL_NEWS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_news_exclude_' . $module_id => array('lang' => 'PORTAL_NEWS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_news_show_last_' . $module_id => array('lang' => 'PORTAL_NEWS_SHOW_LAST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_news_show_last_' . $module_id => array('lang' => 'PORTAL_NEWS_SHOW_LAST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_news_archive_' . $module_id => array('lang' => 'PORTAL_NEWS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_news_archive_' . $module_id => array('lang' => 'PORTAL_NEWS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
@@ -485,23 +485,4 @@ class news extends module_base
|
|||||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
return $db->sql_query($sql);
|
return $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store selected forums
|
|
||||||
*
|
|
||||||
* @param string $key Key name
|
|
||||||
* @param int $module_id Module ID
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function store_selected_forums($key, $module_id)
|
|
||||||
{
|
|
||||||
// Get selected extensions
|
|
||||||
$values = $this->request->variable($key, array(0 => ''));
|
|
||||||
|
|
||||||
$news = implode(',', $values);
|
|
||||||
|
|
||||||
set_config($key, $news);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class poll extends module_base
|
|||||||
'title' => 'ACP_PORTAL_POLLS_SETTINGS',
|
'title' => 'ACP_PORTAL_POLLS_SETTINGS',
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'legend1' => 'ACP_PORTAL_POLLS_SETTINGS',
|
'legend1' => 'ACP_PORTAL_POLLS_SETTINGS',
|
||||||
'board3_poll_topic_id_' . $module_id => array('lang' => 'PORTAL_POLL_TOPIC_ID' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => 'store_selected_forums'),
|
'board3_poll_topic_id_' . $module_id => array('lang' => 'PORTAL_POLL_TOPIC_ID' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
|
||||||
'board3_poll_exclude_id_' . $module_id => array('lang' => 'PORTAL_POLL_EXCLUDE_ID' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_poll_exclude_id_' . $module_id => array('lang' => 'PORTAL_POLL_EXCLUDE_ID' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'board3_poll_limit_' . $module_id => array('lang' => 'PORTAL_POLL_LIMIT' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_poll_limit_' . $module_id => array('lang' => 'PORTAL_POLL_LIMIT' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_poll_allow_vote_' . $module_id => array('lang' => 'PORTAL_POLL_ALLOW_VOTE' , 'validate' => 'ibool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_poll_allow_vote_' . $module_id => array('lang' => 'PORTAL_POLL_ALLOW_VOTE' , 'validate' => 'ibool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
@@ -159,25 +159,6 @@ class poll extends module_base
|
|||||||
return $db->sql_query($sql);
|
return $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store selected forums
|
|
||||||
*
|
|
||||||
* @param string $key Key name
|
|
||||||
* @param int $module_id Module ID
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function store_selected_forums($key, $module_id)
|
|
||||||
{
|
|
||||||
// Get selected forums
|
|
||||||
$values = $this->request->variable($key, array(0 => ''));
|
|
||||||
|
|
||||||
$news = implode(',', $values);
|
|
||||||
|
|
||||||
set_config($key, $news);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse template variables for module
|
* Parse template variables for module
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class recent extends module_base
|
|||||||
'legend1' => 'ACP_PORTAL_RECENT_SETTINGS',
|
'legend1' => 'ACP_PORTAL_RECENT_SETTINGS',
|
||||||
'board3_max_topics_' . $module_id => array('lang' => 'PORTAL_MAX_TOPIC', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_max_topics_' . $module_id => array('lang' => 'PORTAL_MAX_TOPIC', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_recent_title_limit_' . $module_id => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'board3_recent_title_limit_' . $module_id => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'board3_recent_forum_' . $module_id => array('lang' => 'PORTAL_RECENT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => 'store_selected_forums'),
|
'board3_recent_forum_' . $module_id => array('lang' => 'PORTAL_RECENT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
|
||||||
'board3_recent_exclude_forums_' . $module_id => array('lang' => 'PORTAL_EXCLUDE_FORUM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board3_recent_exclude_forums_' . $module_id => array('lang' => 'PORTAL_EXCLUDE_FORUM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -252,22 +252,4 @@ class recent extends module_base
|
|||||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
return $db->sql_query($sql);
|
return $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store selected forums
|
|
||||||
*
|
|
||||||
* @param string $key Key name
|
|
||||||
* @param int $module_id Module ID
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function store_selected_forums($key, $module_id)
|
|
||||||
{
|
|
||||||
// Get selected extensions
|
|
||||||
$values = $this->request->variable($key, array(0 => ''));
|
|
||||||
|
|
||||||
$news = implode(',', $values);
|
|
||||||
|
|
||||||
set_config($key, $news);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template, $table_prefix;
|
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template, $table_prefix;
|
||||||
$user = new \board3\portal\tests\mock\user();
|
$user = new \board3\portal\tests\mock\user();
|
||||||
|
$request = new \phpbb_mock_request;
|
||||||
$phpbb_container = new \phpbb_mock_container_builder();
|
$phpbb_container = new \phpbb_mock_container_builder();
|
||||||
// Mock version check
|
// Mock version check
|
||||||
$phpbb_container->set('board3.version.check',
|
$phpbb_container->set('board3.version.check',
|
||||||
@@ -39,7 +40,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
|||||||
new \board3\portal\modules\donation($config, $template, $user),
|
new \board3\portal\modules\donation($config, $template, $user),
|
||||||
));
|
));
|
||||||
$phpbb_container->set('board3.portal.helper', new \board3\portal\includes\helper($phpbb_container->get('board3.module_collection')));
|
$phpbb_container->set('board3.portal.helper', new \board3\portal\includes\helper($phpbb_container->get('board3.module_collection')));
|
||||||
$phpbb_container->set('board3.portal.modules_helper', new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), $config));
|
$phpbb_container->set('board3.portal.modules_helper', new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), $config, $request));
|
||||||
$phpbb_container->setParameter('board3.modules.table', $table_prefix . 'portal_modules');
|
$phpbb_container->setParameter('board3.modules.table', $table_prefix . 'portal_modules');
|
||||||
$phpbb_container->setParameter('board3.config.table', $table_prefix . 'portal_config');
|
$phpbb_container->setParameter('board3.config.table', $table_prefix . 'portal_config');
|
||||||
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
||||||
@@ -61,7 +62,6 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
|||||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||||
));
|
));
|
||||||
$request = new \phpbb_mock_request;
|
|
||||||
$this->portal_module = new \board3\portal\acp\portal_module();
|
$this->portal_module = new \board3\portal\acp\portal_module();
|
||||||
$this->update_portal_modules();
|
$this->update_portal_modules();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
|||||||
$user->timezone = new \DateTimeZone('UTC');
|
$user->timezone = new \DateTimeZone('UTC');
|
||||||
$user->add_lang('common');
|
$user->add_lang('common');
|
||||||
$user->add_lang('../../ext/board3/portal/language/en/portal');
|
$user->add_lang('../../ext/board3/portal/language/en/portal');
|
||||||
|
$request = new \phpbb_mock_request;
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$cache = $this->getMock('\phpbb\cache\cache', array('obtain_word_list', 'get', 'sql_exists', 'put', 'obtain_attach_extensions'));
|
$cache = $this->getMock('\phpbb\cache\cache', array('obtain_word_list', 'get', 'sql_exists', 'put', 'obtain_attach_extensions'));
|
||||||
$cache->expects($this->any())
|
$cache->expects($this->any())
|
||||||
@@ -51,7 +52,7 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
|||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$phpbb_container = new \phpbb_mock_container_builder();
|
$phpbb_container = new \phpbb_mock_container_builder();
|
||||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config);
|
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $request);
|
||||||
$phpbb_container->set('board3.portal.modules_helper', $this->modules_helper);
|
$phpbb_container->set('board3.portal.modules_helper', $this->modules_helper);
|
||||||
$phpbb_container->set('board3.portal.fetch_posts', new \board3\portal\portal\fetch_posts($auth, $cache, $this->config, $this->db, $this->modules_helper, $user));
|
$phpbb_container->set('board3.portal.fetch_posts', new \board3\portal\portal\fetch_posts($auth, $cache, $this->config, $this->db, $this->modules_helper, $user));
|
||||||
$template = $this->getMock('\phpbb\template', array('set_filenames', 'destroy_block_vars', 'assign_block_vars', 'assign_display'));
|
$template = $this->getMock('\phpbb\template', array('set_filenames', 'destroy_block_vars', 'assign_block_vars', 'assign_display'));
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
|||||||
|
|
||||||
protected $modules;
|
protected $modules;
|
||||||
|
|
||||||
|
protected $config;
|
||||||
|
|
||||||
public function getDataSet()
|
public function getDataSet()
|
||||||
{
|
{
|
||||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/auth.xml');
|
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/auth.xml');
|
||||||
@@ -24,9 +26,10 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$auth = new \phpbb\auth\auth();
|
$auth = new \phpbb\auth\auth();
|
||||||
$config = new \phpbb\config\config(array());
|
$this->config = new \phpbb\config\config(array());
|
||||||
|
$request = new \phpbb_mock_request(array('foo' => array('bar')));
|
||||||
|
|
||||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $config);
|
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function data_get_disallowed_forums()
|
public function data_get_disallowed_forums()
|
||||||
@@ -92,4 +95,11 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
|||||||
$this->modules_helper->generate_forum_select('foo', 'bar')
|
$this->modules_helper->generate_forum_select('foo', 'bar')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_store_selected_forums()
|
||||||
|
{
|
||||||
|
$this->assertEmpty($this->config['foo']);
|
||||||
|
$this->modules_helper->store_selected_forums('foo');
|
||||||
|
$this->assertEquals('bar', $this->config['foo']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
|||||||
// Pretend to allow downloads in forum 1
|
// Pretend to allow downloads in forum 1
|
||||||
$auth->acl[1][0] = true;
|
$auth->acl[1][0] = true;
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config);
|
$request = new \phpbb_mock_request;
|
||||||
|
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $request);
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$template = $this->getMock('\phpbb\template', array('set_filenames', 'destroy_block_vars', 'assign_block_vars', 'assign_display'));
|
$template = $this->getMock('\phpbb\template', array('set_filenames', 'destroy_block_vars', 'assign_block_vars', 'assign_display'));
|
||||||
$this->fetch_posts = new \board3\portal\portal\fetch_posts($auth, $cache, $this->config, $this->db, $this->modules_helper, $user);
|
$this->fetch_posts = new \board3\portal\portal\fetch_posts($auth, $cache, $this->config, $this->db, $this->modules_helper, $user);
|
||||||
|
|||||||
Reference in New Issue
Block a user