File tree Expand file tree Collapse file tree 5 files changed +11
-12
lines changed
Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -188,15 +188,14 @@ public function delete_autogroup_rule($autogroups_id)
188188 // If AJAX was used, show user a result message
189189 if ($ this ->request ->is_ajax ())
190190 {
191- $ json_response = new \phpbb \json_response ;
192- $ json_response ->send (array (
191+ return new \Symfony \Component \HttpFoundation \JsonResponse (array (
193192 'MESSAGE_TITLE ' => $ this ->language ->lang ('INFORMATION ' ),
194193 'MESSAGE_TEXT ' => $ this ->language ->lang ('ACP_AUTOGROUPS_DELETE_SUCCESS ' ),
195- 'REFRESH_DATA ' => array (
196- 'time ' => 3
197- )
194+ 'REFRESH_DATA ' => ['time ' => 3 ],
198195 ));
199196 }
197+
198+ return null ;
200199 }
201200
202201 /**
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public function save_autogroup_rule($autogroups_id);
3838 * Delete the auto group rule
3939 *
4040 * @param int $autogroups_id The auto groups identifier to delete
41- * @return void
41+ * @return \Symfony\Component\HttpFoundation\JsonResponse|null
4242 * @access public
4343 */
4444 public function delete_autogroup_rule ($ autogroups_id );
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3- xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.3 /phpunit.xsd"
3+ xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/10.5 /phpunit.xsd"
44 backupGlobals =" true"
55 backupStaticAttributes =" false"
66 colors =" true"
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class base extends \phpbb_database_test_case
2222 *
2323 * @return array vendor/name of extension(s) to test
2424 */
25- protected static function setup_extensions ()
25+ protected static function setup_extensions (): array
2626 {
2727 return array ('phpbb/autogroups ' );
2828 }
Original file line number Diff line number Diff line change 1010
1111namespace phpbb \autogroups \tests \controller ;
1212
13+ use Symfony \Component \HttpFoundation \JsonResponse ;
14+
1315class delete_autogroup_rule_test extends admin_controller_base
1416{
1517 /**
@@ -69,11 +71,9 @@ public function test_delete_autogroup_rule_ajax()
6971 ->method ('is_ajax ' )
7072 ->willReturn (true );
7173
72- // Handle trigger_error() output called from json_response
73- $ this ->setExpectedTriggerError (E_WARNING );
74-
7574 // Call the delete_autogroup_rule() method
76- $ this ->admin_controller ->delete_autogroup_rule (1 );
75+ $ response = $ this ->admin_controller ->delete_autogroup_rule (1 );
76+ self ::assertInstanceOf (JsonResponse::class, $ response );
7777
7878 // Verify the autogroup rule has been removed
7979 self ::assertEquals (0 , $ this ->get_autogroup_rule_count (1 ));
You can’t perform that action at this time.
0 commit comments