@@ -39,21 +39,23 @@ public function testError(): void
3939 {
4040 $ this ->dummyDbi ->addResult ('SHOW COLUMNS FROM `cvv`.`enums` LIKE \'set \'' , false );
4141
42- $ _POST = [
43- 'ajax_request ' => true ,
44- 'db ' => 'cvv ' ,
45- 'table ' => 'enums ' ,
46- 'column ' => 'set ' ,
47- 'curr_value ' => 'b&c ' ,
48- ];
49- $ GLOBALS ['db ' ] = $ _POST ['db ' ];
50- $ GLOBALS ['table ' ] = $ _POST ['table ' ];
42+ $ request = $ this ->createStub (ServerRequest::class);
43+ $ request ->method ('getParsedBodyParam ' )->willReturnMap ([
44+ ['ajax_request ' , null , true ],
45+ ['db ' , null , 'cvv ' ],
46+ ['table ' , null , 'enums ' ],
47+ ['column ' , null , 'set ' ],
48+ ['curr_value ' , null , 'b&c ' ],
49+ ]);
50+
51+ $ GLOBALS ['db ' ] = 'cvv ' ;
52+ $ GLOBALS ['table ' ] = 'enums ' ;
5153
5254 $ GLOBALS ['containerBuilder ' ]->setParameter ('db ' , $ GLOBALS ['db ' ]);
5355 $ GLOBALS ['containerBuilder ' ]->setParameter ('table ' , $ GLOBALS ['table ' ]);
5456 /** @var SetValuesController $sqlController */
5557 $ sqlController = $ GLOBALS ['containerBuilder ' ]->get (SetValuesController::class);
56- $ sqlController ($ this -> createStub (ServerRequest::class) );
58+ $ sqlController ($ request );
5759
5860 $ this ->assertResponseWasNotSuccessfull ();
5961
@@ -87,21 +89,23 @@ public function testSuccess(): void
8789 ]
8890 );
8991
90- $ _POST = [
91- 'ajax_request ' => true ,
92- 'db ' => 'cvv ' ,
93- 'table ' => 'enums ' ,
94- 'column ' => 'set ' ,
95- 'curr_value ' => 'b&c ' ,
96- ];
97- $ GLOBALS ['db ' ] = $ _POST ['db ' ];
98- $ GLOBALS ['table ' ] = $ _POST ['table ' ];
92+ $ request = $ this ->createStub (ServerRequest::class);
93+ $ request ->method ('getParsedBodyParam ' )->willReturnMap ([
94+ ['ajax_request ' , null , true ],
95+ ['db ' , null , 'cvv ' ],
96+ ['table ' , null , 'enums ' ],
97+ ['column ' , null , 'set ' ],
98+ ['curr_value ' , null , 'b&c ' ],
99+ ]);
100+
101+ $ GLOBALS ['db ' ] = 'cvv ' ;
102+ $ GLOBALS ['table ' ] = 'enums ' ;
99103
100104 $ GLOBALS ['containerBuilder ' ]->setParameter ('db ' , $ GLOBALS ['db ' ]);
101105 $ GLOBALS ['containerBuilder ' ]->setParameter ('table ' , $ GLOBALS ['table ' ]);
102106 /** @var SetValuesController $sqlController */
103107 $ sqlController = $ GLOBALS ['containerBuilder ' ]->get (SetValuesController::class);
104- $ sqlController ($ this -> createStub (ServerRequest::class) );
108+ $ sqlController ($ request );
105109
106110 $ this ->assertResponseWasSuccessfull ();
107111
0 commit comments