[ticket/701] Fix tests and move declarations to services file
B3P-701
This commit is contained in:
@@ -65,6 +65,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
$phpbb_container = new \phpbb_mock_container_builder();
|
||||
// Mock module service collection
|
||||
$config = new \phpbb\config\config([]);
|
||||
$db = $this->db;
|
||||
$auth = $this->getMockBuilder('\phpbb\auth\auth')
|
||||
->setMethods(['acl_get'])
|
||||
->getMock();
|
||||
@@ -74,7 +75,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
->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);
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $db, new \phpbb_mock_request, $table_prefix . 'styles');
|
||||
$phpbb_container->set('board3.portal.module_collection',
|
||||
array(
|
||||
new \board3\portal\modules\clock($config, $template),
|
||||
@@ -84,9 +85,10 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
));
|
||||
$this->portal_helper = new \board3\portal\includes\helper($phpbb_container->get('board3.portal.module_collection'));
|
||||
$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->set('board3.portal.modules_helper', $modules_helper);
|
||||
$phpbb_container->setParameter('board3.portal.modules.table', $table_prefix . 'portal_modules');
|
||||
$phpbb_container->setParameter('board3.portal.config.table', $table_prefix . 'portal_config');
|
||||
$phpbb_container->setParameter('core.table_prefix', $table_prefix);
|
||||
$this->portal_columns = new \board3\portal\portal\columns();
|
||||
$phpbb_container->set('board3.portal.columns', $this->portal_columns);
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||
@@ -114,7 +116,6 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
->method('sql_save')
|
||||
->with($this->anything())
|
||||
->will($this->returnArgument(2));
|
||||
$db = $this->db;
|
||||
$this->language->set(array(
|
||||
'UNABLE_TO_MOVE' => 'UNABLE_TO_MOVE',
|
||||
'UNABLE_TO_MOVE_ROW' => 'UNABLE_TO_MOVE_ROW',
|
||||
@@ -208,6 +209,8 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
'module_image_height' => '0',
|
||||
'module_group_ids' => '',
|
||||
'module_status' => '1',
|
||||
'module_fa_icon' => '',
|
||||
'module_fa_size' => '16',
|
||||
), $module_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class helper_test extends \board3\portal\tests\testframework\test_case
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
$this->user->data['group_id'] = 2;
|
||||
$this->user->style['style_name'] = 'prosilver';
|
||||
$this->phpbb_root_path = dirname(__FILE__) . '/../../../../../../';
|
||||
$phpbb_extension_manager = new \phpbb_mock_extension_manager($this->phpbb_root_path, array('board3/portal'));
|
||||
$this->language_file_loader->set_extension_manager($phpbb_extension_manager);
|
||||
|
||||
@@ -19,7 +19,7 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
global $auth, $cache, $config, $phpbb_container, $phpbb_dispatcher, $template, $user, $phpbb_root_path, $phpEx;
|
||||
global $auth, $cache, $config, $phpbb_container, $phpbb_dispatcher, $template, $user, $phpbb_root_path, $phpEx, $table_prefix;
|
||||
|
||||
$config = new \phpbb\config\config([
|
||||
'allow_nocensors' => false,
|
||||
@@ -71,7 +71,7 @@ class phpbb_functions_fetch_news_test extends \board3\portal\tests\testframework
|
||||
$phpbb_container = new \phpbb_mock_container_builder();
|
||||
$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);
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, $this->db, $request, $table_prefix . 'styles');
|
||||
$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->getMockBuilder('\phpbb\template')
|
||||
|
||||
@@ -26,7 +26,7 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
|
||||
global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $table_prefix;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@@ -35,7 +35,6 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
$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');
|
||||
$phpbb_container = new \phpbb_mock_container_builder();
|
||||
$phpbb_dispatcher = $this->getMockBuilder('\phpbb\event\dispatcher')
|
||||
->setMethods(['trigger_event'])
|
||||
->getMock();
|
||||
@@ -44,7 +43,7 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
->with($this->anything())
|
||||
->will($this->returnArgument(1));
|
||||
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, $request);
|
||||
$this->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, $this->db, $request, $table_prefix . 'styles');
|
||||
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $request, $user;
|
||||
global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $request, $user, $table_prefix;
|
||||
|
||||
$this->path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
@@ -65,7 +65,7 @@ class phpbb_unit_modules_calendar_test extends \board3\portal\tests\testframewor
|
||||
$this->template = new \board3\portal\tests\mock\template($this);
|
||||
$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());
|
||||
$modules_helper = new \board3\portal\includes\modules_helper(new \phpbb\auth\auth(), new \phpbb\config\config(array()), $controller_helper, $this->db, new \phpbb_mock_request(), $table_prefix . 'styles');
|
||||
$request = $this->request = new \phpbb_mock_request();
|
||||
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
|
||||
$this->language = new \board3\portal\tests\mock\language($this->language_file_loader);
|
||||
|
||||
@@ -22,7 +22,7 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $auth, $cache, $config, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $template, $user;
|
||||
global $auth, $cache, $config, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $template, $user, $table_prefix;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@@ -76,7 +76,7 @@ class phpbb_portal_fetch_posts_test extends \board3\portal\tests\testframework\d
|
||||
$this->auth = $auth;
|
||||
$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->modules_helper = new \board3\portal\includes\modules_helper($auth, $this->config, $controller_helper, $this->db, new phpbb_mock_request(), $table_prefix . 'styles');
|
||||
$this->user = $user;
|
||||
$template = $this->getMockBuilder('\phpbb\template')
|
||||
->setMethods(['set_filenames', 'destroy_block_vars', 'assign_block_vars', 'assign_display'])
|
||||
|
||||
@@ -39,7 +39,7 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $cache, $db, $portal_config, $phpbb_root_path, $phpEx;
|
||||
global $cache, $db, $portal_config, $phpbb_root_path, $phpEx, $table_prefix;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@@ -56,7 +56,7 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
||||
|
||||
$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);
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $this->db, $this->request, $table_prefix . 'styles');
|
||||
|
||||
$this->portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
|
||||
@@ -33,7 +33,7 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $cache, $db, $phpbb_root_path, $phpEx;
|
||||
global $cache, $db, $phpbb_root_path, $phpEx, $table_prefix;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@@ -47,7 +47,7 @@ class board3_portal_modules_manager_test extends \board3\portal\tests\testframew
|
||||
|
||||
$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, $request);
|
||||
$modules_helper = new \board3\portal\includes\modules_helper($auth, $config, $controller_helper, $this->db, $request, $table_prefix . 'styles');
|
||||
|
||||
$portal_helper = new \board3\portal\includes\helper(array(
|
||||
new \board3\portal\modules\clock($config, null),
|
||||
|
||||
Reference in New Issue
Block a user