Skip to content

Commit 98e1fc4

Browse files
committed
Update notification class
1 parent 05dfa4e commit 98e1fc4

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

config/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ services:
130130
parent: notification.type.base
131131
shared: false
132132
calls:
133-
- [set_additional_services, ['@config', '@controller.helper', '@user_loader']]
133+
- [set_additional_services, ['@config', '@user_loader']]
134134
tags:
135135
- { name: notification.type }

notification/type/status.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
namespace phpbb\ideas\notification\type;
1212

1313
use phpbb\config\config;
14-
use phpbb\controller\helper;
1514
use phpbb\ideas\ext;
1615
use phpbb\user_loader;
1716
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -24,9 +23,6 @@ class status extends \phpbb\notification\type\base
2423
/** @var config */
2524
protected $config;
2625

27-
/** @var helper */
28-
protected $helper;
29-
3026
/** @var user_loader */
3127
protected $user_loader;
3228

@@ -37,13 +33,11 @@ class status extends \phpbb\notification\type\base
3733
* Set additional services and properties
3834
*
3935
* @param config $config
40-
* @param helper $helper
4136
* @param user_loader $user_loader
4237
* @return void
4338
*/
44-
public function set_additional_services(config $config, helper $helper, user_loader $user_loader)
39+
public function set_additional_services(config $config, user_loader $user_loader)
4540
{
46-
$this->helper = $helper;
4741
$this->user_loader = $user_loader;
4842
$this->ideas_forum_id = (int) $config['ideas_forum_id'];
4943
}
@@ -168,7 +162,7 @@ public function get_url($reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
168162
{
169163
$params = ['idea_id' => $this->get_data('idea_id')];
170164

171-
return $this->helper->route('phpbb_ideas_idea_controller', $params, true, false, $reference_type);
165+
return $this->controller_helper->route('phpbb_ideas_idea_controller', $params, true, false, $reference_type);
172166
}
173167

174168
/**

tests/notification/status_test.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@ protected function setUp(): void
5454
$user = new \phpbb\user($this->language, '\phpbb\datetime');
5555
$user->data['user_options'] = 230271;
5656
$cache = new \phpbb_mock_cache();
57+
$avatar_helper = $this->getMockBuilder('\phpbb\avatar\helper')
58+
->disableOriginalConstructor()
59+
->getMock();
5760

5861
$this->forum_id = 5;
5962
$this->config->expects($this->once())
6063
->method('offsetGet')
6164
->with('ideas_forum_id')
6265
->willReturn($this->forum_id);
6366

64-
$this->notification_type = new status($db, $this->language, $user, $this->auth, $phpbb_root_path, $phpEx, 'phpbb_user_notifications');
65-
$this->notification_type->set_additional_services($this->config, $this->helper, $this->user_loader);
67+
$this->notification_type = new status($avatar_helper, $this->helper, $db, $this->language, $user, $this->auth, $phpbb_root_path, $phpEx, 'phpbb_user_notifications');
68+
$this->notification_type->set_additional_services($this->config, $this->user_loader);
6669

6770
// Set protected properties using reflection
6871
$reflection = new \ReflectionClass($this->notification_type);

0 commit comments

Comments
 (0)