Skip to content

Commit 42315b4

Browse files
committed
Fix tests
1 parent 605f3ce commit 42315b4

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

tests/controller/admin_controller_base.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function setUp(): void
5252
{
5353
parent::setUp();
5454

55-
global $user, $phpbb_root_path, $phpEx;
55+
global $language, $user, $phpbb_root_path, $phpEx;
5656

5757
$cache = new \phpbb_mock_cache();
5858
$this->db = $this->new_dbal();
@@ -69,6 +69,7 @@ protected function setUp(): void
6969
->getMock();
7070
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
7171
$lang = new \phpbb\language\language($lang_loader);
72+
$language = $lang;
7273
$user = new \phpbb\user($lang, '\phpbb\datetime');
7374
$user->data['user_id'] = 2;
7475
$user->data['user_form_salt'] = '';

tests/extension/ext_test.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,15 @@ public function test_steps()
6868

6969
protected function create_extension_manager()
7070
{
71-
global $phpbb_root_path, $php_ext;
71+
$phpbb_root_path = __DIR__ . './../../../../';
72+
$php_ext = 'php';
7273

7374
$config = new \phpbb\config\config(['version' => PHPBB_VERSION, 'allow_board_notifications' => 1]);
7475
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
7576
$factory = new \phpbb\db\tools\factory();
76-
$db_tools = $factory->get($this->db);
77+
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $php_ext);
78+
$db_doctrine = $this->new_doctrine_dbal();
79+
$db_tools = $factory->get($db_doctrine);
7780
$table_prefix = 'phpbb_';
7881

7982
$container = new \phpbb_mock_container_builder();
@@ -87,11 +90,12 @@ protected function create_extension_manager()
8790
$phpbb_root_path,
8891
$php_ext,
8992
$table_prefix,
93+
self::get_core_tables(),
9094
[],
9195
new \phpbb\db\migration\helper()
9296
);
9397
$container->set('migrator', $migrator);
94-
$container->set('dispatcher', $phpbb_dispatcher);
98+
$container->set('event_dispatcher', $phpbb_dispatcher);
9599

96100
$cache_driver = new \phpbb\cache\driver\dummy();
97101
$cache = new \phpbb\cache\service(
@@ -105,7 +109,11 @@ protected function create_extension_manager()
105109

106110
$language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $php_ext));
107111

108-
$user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $php_ext, USERS_TABLE);
112+
$avatar_helper = $this->getMockBuilder('\phpbb\avatar\helper')
113+
->disableOriginalConstructor()
114+
->getMock();
115+
116+
$user_loader = new \phpbb\user_loader($avatar_helper, $this->db, $phpbb_root_path, $php_ext, USERS_TABLE);
109117
$user = $this->createMock('\phpbb\user');
110118

111119
$container->set('notification.method.board', new \phpbb\notification\method\board(
@@ -137,10 +145,9 @@ protected function create_extension_manager()
137145
$container,
138146
$this->db,
139147
$config,
140-
new \phpbb\filesystem\filesystem(),
141-
EXT_TABLE,
148+
$finder_factory,
149+
'phpbb_ext',
142150
$phpbb_root_path,
143-
$php_ext,
144151
null
145152
);
146153
}

0 commit comments

Comments
 (0)