1414use phpbb \db \driver \driver_interface as dbal ;
1515use phpbb_mock_cache ;
1616use phpbb_mock_event_dispatcher ;
17+ use PHPUnit \DbUnit \DataSet \DefaultDataSet ;
18+ use PHPUnit \DbUnit \DataSet \XmlDataSet ;
1719use PHPUnit \Framework \MockObject \MockObject ;
1820use phpbb \config \config ;
1921use phpbb \exception \runtime_exception ;
2527use phpbb \request \request_interface ;
2628use phpbb \template \template ;
2729use phpbb_database_test_case ;
30+ use phpbb \pwakit \acp \pwa_acp_module ;
2831
2932class admin_controller_test extends phpbb_database_test_case
3033{
@@ -34,10 +37,10 @@ class admin_controller_test extends phpbb_database_test_case
3437 protected dbal $ db ;
3538 protected config $ config ;
3639 protected language $ language ;
37- protected request $ request ;
38- protected template | MockObject $ template ;
39- protected helper $ helper ;
40- protected upload $ upload ;
40+ protected MockObject | request $ request ;
41+ protected MockObject | template $ template ;
42+ protected MockObject | helper $ helper ;
43+ protected MockObject | upload $ upload ;
4144 protected string $ phpbb_root_path ;
4245 protected admin_controller $ admin_controller ;
4346
@@ -46,7 +49,7 @@ protected static function setup_extensions(): array
4649 return ['phpbb/pwakit ' ];
4750 }
4851
49- protected function getDataSet ()
52+ protected function getDataSet (): DefaultDataSet | XmlDataSet
5053 {
5154 return $ this ->createXMLDataSet (__DIR__ . '/../fixtures/styles.xml ' );
5255 }
@@ -124,12 +127,11 @@ public static function module_access_test_data(): array
124127 * @return void
125128 * @dataProvider module_access_test_data
126129 */
127- public function test_module_access ($ mode , $ expected )
130+ public function test_module_access ($ mode , $ expected ): void
128131 {
129132 $ this ->request ->expects ($ expected ? $ this ->atLeastOnce () : $ this ->never ())
130133 ->method ('is_set_post ' );
131134
132-
133135 $ this ->call_admin_controller ($ mode );
134136 }
135137
@@ -146,7 +148,7 @@ public static function form_checks_data(): array
146148 * @param $action
147149 * @dataProvider form_checks_data
148150 */
149- public function test_form_checks ($ action )
151+ public function test_form_checks ($ action ): void
150152 {
151153 self ::$ valid_form = false ;
152154
@@ -208,7 +210,7 @@ public static function display_settings_test_data(): array
208210 * @param $expected
209211 * @dataProvider display_settings_test_data
210212 */
211- public function test_display_settings ($ configs , $ expected )
213+ public function test_display_settings ($ configs , $ expected ): void
212214 {
213215 foreach ($ configs as $ key => $ value )
214216 {
@@ -350,10 +352,10 @@ public static function submit_test_data(): array
350352 * @param $expected_msg
351353 * @dataProvider submit_test_data
352354 */
353- public function test_submit ($ form_data , $ expected , $ expected_msg )
355+ public function test_submit ($ form_data , $ expected , $ expected_msg ): void
354356 {
355357 $ is_success = $ expected_msg === 'CONFIG_UPDATED ' ;
356-
358+
357359 if ($ is_success )
358360 {
359361 $ this ->setExpectedTriggerError (E_USER_NOTICE , 'CONFIG_UPDATED ' );
@@ -380,7 +382,7 @@ public function test_submit($form_data, $expected, $expected_msg)
380382 ]);
381383
382384 $ this ->request_submit ('submit ' );
383-
385+
384386 if ($ is_success )
385387 {
386388 $ this ->call_admin_controller ();
@@ -404,7 +406,7 @@ public function test_submit($form_data, $expected, $expected_msg)
404406 $ this ->assertSame ($ expected , $ rows );
405407 }
406408
407- public function test_upload ()
409+ public function test_upload (): void
408410 {
409411 $ this ->setExpectedTriggerError (E_USER_NOTICE , 'ACP_PWA_IMG_UPLOAD_SUCCESS ' );
410412
@@ -417,7 +419,7 @@ public function test_upload()
417419 $ this ->call_admin_controller ();
418420 }
419421
420- public function test_upload_error ()
422+ public function test_upload_error (): void
421423 {
422424 $ this ->request_submit ('upload ' );
423425
@@ -431,7 +433,7 @@ public function test_upload_error()
431433 $ this ->call_admin_controller ();
432434 }
433435
434- public function test_resync ()
436+ public function test_resync (): void
435437 {
436438 $ this ->request_submit ('resync ' );
437439
@@ -468,7 +470,7 @@ public static function delete_test_data(): array
468470 * @param $error
469471 * @dataProvider delete_test_data
470472 */
471- public function test_delete ($ image , $ confirmed , $ error )
473+ public function test_delete ($ image , $ confirmed , $ error ): void
472474 {
473475 self ::$ confirm = $ confirmed ;
474476
@@ -510,7 +512,7 @@ public function test_delete($image, $confirmed, $error)
510512 */
511513 private function call_admin_controller (string $ mode = 'settings ' ): void
512514 {
513- $ this ->admin_controller ->main ('\\ phpbb \\ pwakit \\ acp \\ pwa_acp_module ' , $ mode , '' );
515+ $ this ->admin_controller ->main (pwa_acp_module::class , $ mode , '' );
514516 }
515517
516518 /**
@@ -533,7 +535,7 @@ private function request_submit($value): void
533535 */
534536function check_form_key (): bool
535537{
536- return \ phpbb \ pwakit \ controller \ admin_controller_test::$ valid_form ;
538+ return admin_controller_test::$ valid_form ;
537539}
538540
539541/**
@@ -552,7 +554,7 @@ function add_form_key()
552554 */
553555function confirm_box (): bool
554556{
555- return \ phpbb \ pwakit \ controller \ admin_controller_test::$ confirm ;
557+ return admin_controller_test::$ confirm ;
556558}
557559
558560/**
0 commit comments