Merge pull request #437 from marc1706/ticket/436
[ticket/436] Create routes using controller helper instead of directly creating app.php links
This commit is contained in:
@@ -46,6 +46,7 @@ services:
|
||||
class: board3\portal\modules\calendar
|
||||
arguments:
|
||||
- @config
|
||||
- @board3.portal.modules_helper
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
@@ -210,6 +211,7 @@ services:
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
- @board3.portal.modules_helper
|
||||
tags:
|
||||
- { name: board3.portal.module }
|
||||
|
||||
@@ -259,11 +261,10 @@ services:
|
||||
class: board3\portal\modules\stylechanger
|
||||
arguments:
|
||||
- @config
|
||||
- @board3.portal.modules_helper
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- %core.php_ext%
|
||||
- %core.root_path%
|
||||
- @user
|
||||
tags:
|
||||
- { name: board3.portal.module }
|
||||
|
||||
@@ -68,6 +68,7 @@ services:
|
||||
arguments:
|
||||
- @auth
|
||||
- @config
|
||||
- @controller.helper
|
||||
- @request
|
||||
|
||||
board3.portal.columns:
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace board3\portal\includes;
|
||||
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
class modules_helper
|
||||
{
|
||||
/**
|
||||
@@ -23,6 +25,9 @@ class modules_helper
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\controller\helper Controller helper */
|
||||
protected $controller_helper;
|
||||
|
||||
/**
|
||||
* phpBB request
|
||||
* @var \phpbb\request\request
|
||||
@@ -35,12 +40,14 @@ class modules_helper
|
||||
* the dependencies defined in the services.yml file for this service.
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\controller\helper $controller_helper Controller helper
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
*/
|
||||
public function __construct($auth, $config, $request)
|
||||
public function __construct($auth, $config, $controller_helper, $request)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->controller_helper = $controller_helper;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
@@ -135,4 +142,20 @@ class modules_helper
|
||||
$news = implode(',', $values);
|
||||
$this->config->set($key, $news);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method for controller_helper::route()
|
||||
*
|
||||
* @param string $route Route name
|
||||
* @param array $params Route parameters
|
||||
* @param bool $is_amp
|
||||
* @param bool $session_id
|
||||
* @param bool $reference_type
|
||||
*
|
||||
* @return string URL for route
|
||||
*/
|
||||
public function route($route, $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||
{
|
||||
return $this->controller_helper->route($route, $params, $is_amp, $session_id, $reference_type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ class announcements extends module_base
|
||||
|
||||
if ($this->config['board3_number_of_announcements_' . $module_id] != 0 && $this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start, 'announcements', $module_id);
|
||||
$pagination = generate_portal_pagination($this->modules_helper->route('board3_portal_controller'), $total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start, 'announcements', $module_id);
|
||||
|
||||
$announcements_row = array_merge($announcements_row, array(
|
||||
'AP_PAGINATION' => (isset($pagination)) ? $pagination : '',
|
||||
@@ -340,7 +340,7 @@ class announcements extends module_base
|
||||
'U_VIEW_COMMENTS' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id),
|
||||
'U_VIEW_UNREAD' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&view=unread#unread'),
|
||||
'U_POST_COMMENT' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", 'mode=reply&' . (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id),
|
||||
'U_READ_FULL' => append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", $read_full_url),
|
||||
'U_READ_FULL' => $this->modules_helper->route('board3_portal_controller') . '?' . $read_full_url,
|
||||
'L_READ_FULL' => $read_full,
|
||||
'OPEN' => $open_bracket,
|
||||
'CLOSE' => $close_bracket,
|
||||
@@ -374,7 +374,7 @@ class announcements extends module_base
|
||||
*/
|
||||
if (!isset($fetch_news[$i]))
|
||||
{
|
||||
redirect(append_sid($this->phpbb_root_path . 'app.' . $this->php_ext, '/portal#top'));
|
||||
redirect($this->modules_helper->route('board3_portal_controller') . '#top');
|
||||
}
|
||||
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
@@ -386,7 +386,7 @@ class announcements extends module_base
|
||||
$read_full = $this->user->lang['BACK'];
|
||||
$real_forum_id = ($forum_id == 0) ? $fetch_news['global_id']: $forum_id;
|
||||
|
||||
$read_full_url = ($this->request->is_set('ap_' . $module_id)) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "ap_{$module_id}=$start#a_{$module_id}_$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#a_{$module_id}_$i");
|
||||
$read_full_url = ($this->request->is_set('ap_' . $module_id)) ? $this->modules_helper->route('board3_portal_controller') . "?ap_{$module_id}=$start#a_{$module_id}_$i" : $this->modules_helper->route('board3_portal_controller') . "#a_{$module_id}_$i";
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
|
||||
$this->template->assign_block_vars('announcements.center_row', array(
|
||||
|
||||
@@ -89,13 +89,13 @@ class calendar extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
/** @var \phpbb\request\request_interface */
|
||||
protected $request;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
@@ -116,22 +116,27 @@ class calendar extends module_base
|
||||
/** @var \phpbb\log\log phpBB log */
|
||||
protected $log;
|
||||
|
||||
/** @var \board3\portal\includes\modules_helper */
|
||||
protected $modules_helper;
|
||||
|
||||
/**
|
||||
* Construct a calendar object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \board3\portal\includes\modules_helper $modules_helper Modules helper
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
* @param \phpbb\request\request_interface $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \phpbb\path_helper $path_helper phpBB path helper
|
||||
* @param \phpbb\log\log $log phpBB log object
|
||||
*/
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $path_helper, $log)
|
||||
public function __construct($config, $modules_helper, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $path_helper, $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->modules_helper = $modules_helper;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
@@ -183,8 +188,8 @@ class calendar extends module_base
|
||||
// output our general calendar bits
|
||||
$down = $this->mini_cal_month - 1;
|
||||
$up = $this->mini_cal_month + 1;
|
||||
$prev_month = '<a href="' . append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "m$module_id=$down#minical$module_id") . '"><img src="' . $this->portal_root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $this->user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="<<" /></a>';
|
||||
$next_month = '<a href="' . append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "m$module_id=$up#minical$module_id") . '"><img src="' . $this->portal_root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $this->user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt=">>" /></a>';
|
||||
$prev_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$down#minical$module_id" . '"><img src="' . $this->portal_root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $this->user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="<<" /></a>';
|
||||
$next_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$up#minical$module_id" . '"><img src="' . $this->portal_root_path . 'styles/' . $this->user->style['style_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $this->user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt=">>" /></a>';
|
||||
|
||||
$this->template->assign_block_vars('minical', array(
|
||||
'S_SUNDAY_FIRST' => ($this->config['board3_sunday_first_' . $module_id]) ? true : false,
|
||||
|
||||
@@ -228,7 +228,7 @@ class news extends module_base
|
||||
// Create pagination if necessary
|
||||
if ($this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"), $total_news, $this->config['board3_number_of_news_' . $module_id], $start, ($this->config['board3_show_all_news_' . $module_id]) ? 'news_all' : 'news', $module_id);
|
||||
$pagination = generate_portal_pagination($this->modules_helper->route('board3_portal_controller'), $total_news, $this->config['board3_number_of_news_' . $module_id], $start, ($this->config['board3_show_all_news_' . $module_id]) ? 'news_all' : 'news', $module_id);
|
||||
}
|
||||
|
||||
if ($this->config['board3_number_of_news_' . $module_id] <> 0 && $this->config['board3_news_archive_' . $module_id])
|
||||
@@ -338,7 +338,7 @@ class news extends module_base
|
||||
'U_VIEW_COMMENTS' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
|
||||
'U_VIEW_UNREAD' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id'] . '&view=unread#unread'),
|
||||
'U_POST_COMMENT' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", 'mode=reply&f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
|
||||
'U_READ_FULL' => append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", $read_full_url),
|
||||
'U_READ_FULL' => $this->modules_helper->route('board3_portal_controller') . '?' . $read_full_url,
|
||||
'L_READ_FULL' => $read_full,
|
||||
'OPEN' => $open_bracket,
|
||||
'CLOSE' => $close_bracket,
|
||||
@@ -370,7 +370,7 @@ class news extends module_base
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $this->user->lang['BACK'];
|
||||
|
||||
$read_full_url = ($this->request->is_set('np_' . $module_id)) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "np_$module_id=$start#n_{$module_id}_$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#n_{$module_id}_$i");
|
||||
$read_full_url = ($this->request->is_set('np_' . $module_id)) ? $this->modules_helper->route('board3_portal_controller') . "?np_$module_id=$start#n_{$module_id}_$i" : $this->modules_helper->route('board3_portal_controller') . "#n_{$module_id}_$i";
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
|
||||
$this->template->assign_block_vars('news.news_row', array(
|
||||
|
||||
@@ -71,6 +71,9 @@ class poll extends module_base
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \board3\portal\includes\modules_helper */
|
||||
protected $modules_helper;
|
||||
|
||||
/**
|
||||
* Construct a poll object
|
||||
*
|
||||
@@ -82,8 +85,9 @@ class poll extends module_base
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \board3\portal\includes\modules_helper $modules_helper Modules helper
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($auth, $config, $db, $request, $template, $phpbb_root_path, $phpEx, $user, $modules_helper)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
@@ -93,6 +97,7 @@ class poll extends module_base
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
$this->modules_helper = $modules_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +236,7 @@ class poll extends module_base
|
||||
|
||||
if($s_can_up_vote)
|
||||
{
|
||||
$redirect_url = append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal");
|
||||
$redirect_url = $this->modules_helper->route('board3_portal_controller');
|
||||
|
||||
if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id))
|
||||
{
|
||||
@@ -449,8 +454,8 @@ class poll extends module_base
|
||||
}
|
||||
|
||||
$poll_view_str = urlencode(implode(',', $make_poll_view));
|
||||
$portalpoll_url= append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "polls=$poll_view_str");
|
||||
$portalvote_url= append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "f=$forum_id&t=$topic_id");
|
||||
$portalpoll_url= $this->modules_helper->route('board3_portal_controller') . "?polls=$poll_view_str";
|
||||
$portalvote_url= $this->modules_helper->route('board3_portal_controller') . "?f=$forum_id&t=$topic_id";
|
||||
$viewtopic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f=$forum_id&t=$topic_id");
|
||||
$poll_end = $data['poll_length'] + $data['poll_start'];
|
||||
|
||||
|
||||
@@ -44,21 +44,18 @@ class stylechanger extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
/** @var \board3\portal\includes\modules_helper */
|
||||
protected $modules_helper;
|
||||
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
/** @var \phpbb\request\request_interface */
|
||||
protected $request;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/** @var string phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
@@ -66,21 +63,19 @@ class stylechanger extends module_base
|
||||
* Construct a stylechanger object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \board3\portal\includes\modules_helper $modules_helper Modules helper
|
||||
* @param \phpbb\template\template $template phpBB template
|
||||
* @param \phpbb\db\driver\driver_interface $db Database driver
|
||||
* @param \phpbb\request\request_interface $request phpBB request
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($config, $template, $db, $request, $phpEx, $phpbb_root_path, $user)
|
||||
public function __construct($config, $modules_helper, $template, $db, $request, $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->modules_helper = $modules_helper;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
@@ -101,11 +96,11 @@ class stylechanger extends module_base
|
||||
$style = $this->request->variable('style', 0);
|
||||
if (!empty($style))
|
||||
{
|
||||
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"));
|
||||
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], $this->modules_helper->route('board3_portal_controller'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", 'style=' . $row['style_id']);
|
||||
$url = $this->modules_helper->route('board3_portal_controller') . '?style=' . $row['style_id'];
|
||||
}
|
||||
++$style_count;
|
||||
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $this->user->style['style_id'] ? ' selected="selected"' : '') . '>' . utf8_htmlspecialchars($row['style_name']) . '</option>';
|
||||
|
||||
35
tests/mock/controller_helper.php
Normal file
35
tests/mock/controller_helper.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2015 Board3 Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\tests\mock;
|
||||
|
||||
class controller_helper
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
|
||||
protected $php_ext;
|
||||
|
||||
protected $routes;
|
||||
|
||||
public function __construct($phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
|
||||
public function add_route($name, $url)
|
||||
{
|
||||
$this->routes[$name] = $url;
|
||||
}
|
||||
|
||||
public function route($route)
|
||||
{
|
||||
return append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/{$this->routes[$route]}");
|
||||
}
|
||||
}
|
||||
@@ -53,8 +53,10 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
new \board3\portal\modules\donation($config, $template, $user),
|
||||
));
|
||||
$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, $request));
|
||||
$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');
|
||||
$phpbb_container->setParameter('board3.portal.config.table', $table_prefix . 'portal_config');
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
|
||||
@@ -20,7 +20,7 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
global $auth, $cache, $config, $phpbb_container, $phpbb_dispatcher, $template, $user;
|
||||
global $auth, $cache, $phpbb_container, $phpbb_dispatcher, $template, $user, $phpbb_root_path, $phpEx;
|
||||
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->data['user_id'] = 2;
|
||||
@@ -52,7 +52,9 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
$this->auth = $auth;
|
||||
$this->user = $user;
|
||||
$phpbb_container = new \phpbb_mock_container_builder();
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $request);
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, $request);
|
||||
$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));
|
||||
$template = $this->getMock('\phpbb\template', array('set_filenames', 'destroy_block_vars', 'assign_block_vars', 'assign_display'));
|
||||
|
||||
@@ -23,13 +23,17 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$auth = new \phpbb\auth\auth();
|
||||
$this->config = new \phpbb\config\config(array());
|
||||
$request = new \phpbb_mock_request(array('foo' => array('bar')));
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $request);
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, $request);
|
||||
}
|
||||
|
||||
public function data_get_disallowed_forums()
|
||||
|
||||
@@ -28,7 +28,7 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
global $cache, $phpbb_root_path;
|
||||
global $cache, $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
@@ -40,7 +40,10 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
'php'
|
||||
);
|
||||
self::$config = new \phpbb\config\config(array());
|
||||
$this->calendar = new \board3\portal\modules\calendar(self::$config, null, null, null, dirname(__FILE__) . '/../../../', 'php', null, $this->path_helper, null);
|
||||
$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(new \phpbb\auth\auth(), new \phpbb\config\config(array()), $controller_helper, new \phpbb_mock_request());
|
||||
$this->calendar = new \board3\portal\modules\calendar(self::$config, $modules_helper, null, null, null, dirname(__FILE__) . '/../../../', 'php', null, $this->path_helper, null);
|
||||
define('PORTAL_MODULES_TABLE', 'phpbb_portal_modules');
|
||||
define('PORTAL_CONFIG_TABLE', 'phpbb_portal_config');
|
||||
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
||||
|
||||
@@ -19,7 +19,7 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $auth, $cache, $phpbb_dispatcher, $template, $user;
|
||||
global $auth, $cache, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $template, $user;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@@ -50,7 +50,9 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
||||
// Pretend to allow downloads in forum 1
|
||||
$auth->acl[1][0] = true;
|
||||
$this->auth = $auth;
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, new phpbb_mock_request());
|
||||
$controller_helper = new \board3\portal\tests\mock\controller_helper($phpbb_root_path, $phpEx);
|
||||
$controller_helper->add_route('board3_portal_controller', 'portal');
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, new phpbb_mock_request());
|
||||
$this->user = $user;
|
||||
$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);
|
||||
|
||||
Reference in New Issue
Block a user