Skip to content

Commit 7b1c93f

Browse files
committed
Try fixing tests
1 parent a6416c0 commit 7b1c93f

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

tests/core/core_url_test.php

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,43 @@ class core_url_test extends core_base
2222
public function setUp() : void
2323
{
2424
parent::setUp();
25+
26+
// Mock dependencies
27+
$this->template = $this->getMockBuilder(\phpbb\template\template::class)
28+
->disableOriginalConstructor()
29+
->getMock();
30+
31+
$this->request = $this->getMockBuilder(\phpbb\request\request::class)
32+
->disableOriginalConstructor()
33+
->getMock();
34+
35+
$this->config = [
36+
'server_name' => 'localhost',
37+
'force_server_vars' => 0,
38+
'server_protocol' => 'http://',
39+
];
40+
41+
$this->configObj = $this->getMockBuilder(\phpbb\config\config::class)
42+
->disableOriginalConstructor()
43+
->getMock();
44+
$this->configObj->method('offsetGet')->willReturnCallback(function($key) {
45+
$defaults = [
46+
'server_name' => 'localhost',
47+
'force_server_vars' => 0,
48+
'server_protocol' => 'http://',
49+
];
50+
return $defaults[$key] ?? null;
51+
});
52+
$this->configObj->method('offsetExists')->willReturn(true);
53+
54+
$this->phpbb_root_path = '/';
55+
$this->php_ext = 'php';
56+
2557
$this->gallery_url = new \phpbbgallery\core\url(
26-
$this->config,
27-
$this->user,
28-
$this->root_path,
58+
$this->template,
59+
$this->request,
60+
$this->configObj,
61+
$this->phpbb_root_path,
2962
$this->php_ext
3063
);
3164
}

0 commit comments

Comments
 (0)