@@ -24,9 +24,6 @@ class status_test extends \phpbb_test_case
2424 /** @var \phpbb\controller\helper|\PHPUnit\Framework\MockObject\MockObject */
2525 protected $ helper ;
2626
27- /** @var \phpbb\ideas\factory\idea|\PHPUnit\Framework\MockObject\MockObject */
28- protected $ idea_factory ;
29-
3027 /** @var \phpbb\user_loader|\PHPUnit\Framework\MockObject\MockObject */
3128 protected $ user_loader ;
3229
@@ -47,7 +44,6 @@ protected function setUp(): void
4744
4845 $ this ->config = $ this ->createMock (\phpbb \config \config::class);
4946 $ this ->helper = $ this ->createMock (\phpbb \controller \helper::class);
50- $ this ->idea_factory = $ this ->createMock (\phpbb \ideas \factory \idea::class);
5147 $ this ->user_loader = $ this ->createMock (\phpbb \user_loader::class);
5248 $ this ->auth = $ this ->createMock (\phpbb \auth \auth::class);
5349 $ this ->language = $ this ->createMock (\phpbb \language \language::class);
@@ -64,7 +60,7 @@ protected function setUp(): void
6460 ->willReturn ($ this ->forum_id );
6561
6662 $ this ->notification_type = new status ($ db , $ this ->language , $ user , $ this ->auth , $ phpbb_root_path , $ phpEx , 'phpbb_user_notifications ' );
67- $ this ->notification_type ->set_additional_services ($ this ->config , $ this ->helper , $ this ->idea_factory , $ this -> user_loader );
63+ $ this ->notification_type ->set_additional_services ($ this ->config , $ this ->helper , $ this ->user_loader );
6864
6965 // Set protected properties using reflection
7066 $ reflection = new \ReflectionClass ($ this ->notification_type );
@@ -130,20 +126,14 @@ public function test_find_users_for_notification()
130126 $ idea_id = 1 ;
131127 $ idea_author = 2 ;
132128
133- $ type_data = ['idea_id ' => $ idea_id ];
134- $ idea_data = ['idea_author ' => $ idea_author ];
129+ $ type_data = ['idea_id ' => $ idea_id , 'idea_author ' => $ idea_author ];
135130 $ default_methods = ['board ' , 'email ' ];
136131
137132 $ this ->auth ->expects ($ this ->once ())
138133 ->method ('acl_get_list ' )
139134 ->with ([$ idea_author ], 'f_read ' , $ this ->forum_id )
140135 ->willReturn ([$ this ->forum_id => ['f_read ' => [$ idea_author ]]]);
141136
142- $ this ->idea_factory ->expects ($ this ->once ())
143- ->method ('get_idea ' )
144- ->with ($ idea_id )
145- ->willReturn ($ idea_data );
146-
147137 $ this ->notification_manager ->expects ($ this ->once ())
148138 ->method ('get_default_methods ' )
149139 ->willReturn ($ default_methods );
@@ -152,19 +142,6 @@ public function test_find_users_for_notification()
152142 $ this ->assertEquals ([$ idea_author => $ default_methods ], $ result );
153143 }
154144
155- public function test_find_users_for_notification_idea_not_found ()
156- {
157- $ type_data = ['idea_id ' => 999 ];
158-
159- $ this ->idea_factory ->expects ($ this ->once ())
160- ->method ('get_idea ' )
161- ->with (999 )
162- ->willReturn (false );
163-
164- $ result = $ this ->notification_type ->find_users_for_notification ($ type_data );
165- $ this ->assertEquals ([], $ result );
166- }
167-
168145 public function test_get_avatar_with_author ()
169146 {
170147 $ this ->setNotificationData (['updater_id ' => 5 ]);
@@ -333,17 +310,10 @@ public function test_create_insert_array()
333310 $ type_data = [
334311 'idea_id ' => 7 ,
335312 'status ' => 4 ,
336- 'user_id ' => 3
337- ];
338- $ idea_data = [
313+ 'user_id ' => 3 ,
339314 'idea_title ' => 'Sample Idea '
340315 ];
341316
342- $ this ->idea_factory ->expects ($ this ->once ())
343- ->method ('get_idea ' )
344- ->with (7 )
345- ->willReturn ($ idea_data );
346-
347317 $ this ->notification_type ->create_insert_array ($ type_data );
348318
349319 // Verify data was set by checking get_data
0 commit comments