[ticket/289] Add missing class variable to modules_helper

This commit is contained in:
Marc Alexander
2014-07-24 17:51:16 +02:00
parent 7f887b872c
commit d554480697
6 changed files with 15 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ services:
class: board3\portal\includes\modules_helper class: board3\portal\includes\modules_helper
arguments: arguments:
- @auth - @auth
- @config
board3.portal.fetch_posts: board3.portal.fetch_posts:
class: board3\portal\portal\fetch_posts class: board3\portal\portal\fetch_posts

View File

@@ -17,15 +17,23 @@ class modules_helper
*/ */
protected $auth; protected $auth;
/**
* phpBB config
* @var \phpbb\config\config
*/
protected $config;
/** /**
* 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
*/ */
public function __construct($auth) public function __construct($auth, $config)
{ {
$this->auth = $auth; $this->auth = $auth;
$this->config = $config;
} }
/** /**

View File

@@ -39,7 +39,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())); $phpbb_container->set('board3.portal.modules_helper', new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), $config));
$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'));

View File

@@ -51,7 +51,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->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config);
$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'));

View File

@@ -24,8 +24,9 @@ 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->modules_helper = new \board3\portal\includes\modules_helper($auth); $this->modules_helper = new \board3\portal\includes\modules_helper($auth, $config);
} }
public function data_get_disallowed_forums() public function data_get_disallowed_forums()

View File

@@ -50,7 +50,7 @@ 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->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config);
$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);