44
55namespace PhpMyAdmin \Tests ;
66
7+ use PhpMyAdmin \ConfigStorage \Relation ;
78use PhpMyAdmin \Core ;
89use PhpMyAdmin \DatabaseInterface ;
910use PhpMyAdmin \Dbal \Warning ;
1011use PhpMyAdmin \FieldMetadata ;
12+ use PhpMyAdmin \FileListing ;
1113use PhpMyAdmin \InsertEdit ;
1214use PhpMyAdmin \ResponseRenderer ;
1315use PhpMyAdmin \Table ;
16+ use PhpMyAdmin \Template ;
1417use PhpMyAdmin \Tests \Stubs \DummyResult ;
18+ use PhpMyAdmin \Transformations ;
1519use PhpMyAdmin \Url ;
1620use ReflectionProperty ;
1721use stdClass ;
@@ -70,7 +74,13 @@ protected function setUp(): void
7074 $ GLOBALS ['cfg ' ]['Confirm ' ] = true ;
7175 $ GLOBALS ['cfg ' ]['LoginCookieValidity ' ] = 1440 ;
7276 $ GLOBALS ['cfg ' ]['enable_drag_drop_import ' ] = true ;
73- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
77+ $ this ->insertEdit = new InsertEdit (
78+ $ this ->dbi ,
79+ new Relation ($ this ->dbi ),
80+ new Transformations (),
81+ new FileListing (),
82+ new Template ()
83+ );
7484 }
7585
7686 /**
@@ -198,7 +208,13 @@ public function testAnalyzeWhereClause(): void
198208 );
199209
200210 $ GLOBALS ['dbi ' ] = $ dbi ;
201- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
211+ $ this ->insertEdit = new InsertEdit (
212+ $ GLOBALS ['dbi ' ],
213+ new Relation ($ GLOBALS ['dbi ' ]),
214+ new Transformations (),
215+ new FileListing (),
216+ new Template ()
217+ );
202218 $ result = $ this ->callFunction (
203219 $ this ->insertEdit ,
204220 InsertEdit::class,
@@ -252,7 +268,13 @@ public function testShowEmptyResultMessageOrSetUniqueCondition(): void
252268 ->will ($ this ->returnValue ($ meta_arr ));
253269
254270 $ GLOBALS ['dbi ' ] = $ dbi ;
255- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
271+ $ this ->insertEdit = new InsertEdit (
272+ $ GLOBALS ['dbi ' ],
273+ new Relation ($ GLOBALS ['dbi ' ]),
274+ new Transformations (),
275+ new FileListing (),
276+ new Template ()
277+ );
256278
257279 $ result = $ this ->callFunction (
258280 $ this ->insertEdit ,
@@ -361,7 +383,13 @@ public function testLoadFirstRow($configValue, array $rowsValue): void
361383 ->will ($ this ->returnValue ($ resultStub ));
362384
363385 $ GLOBALS ['dbi ' ] = $ dbi ;
364- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
386+ $ this ->insertEdit = new InsertEdit (
387+ $ GLOBALS ['dbi ' ],
388+ new Relation ($ GLOBALS ['dbi ' ]),
389+ new Transformations (),
390+ new FileListing (),
391+ new Template ()
392+ );
365393
366394 $ result = $ this ->callFunction (
367395 $ this ->insertEdit ,
@@ -1414,7 +1442,13 @@ public function testGetSpecialCharsAndBackupFieldForExistingRow(): void
14141442 ->getMock ();
14151443
14161444 $ GLOBALS ['dbi ' ] = $ dbi ;
1417- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
1445+ $ this ->insertEdit = new InsertEdit (
1446+ $ GLOBALS ['dbi ' ],
1447+ new Relation ($ GLOBALS ['dbi ' ]),
1448+ new Transformations (),
1449+ new FileListing (),
1450+ new Template ()
1451+ );
14181452
14191453 $ current_row ['f ' ] = '123 ' ;
14201454 $ extracted_columnspec ['spec_in_brackets ' ] = '20 ' ;
@@ -1639,7 +1673,13 @@ public function testSetSessionForEditNext(): void
16391673 $ GLOBALS ['dbi ' ] = $ dbi ;
16401674 $ GLOBALS ['db ' ] = 'db ' ;
16411675 $ GLOBALS ['table ' ] = 'table ' ;
1642- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
1676+ $ this ->insertEdit = new InsertEdit (
1677+ $ GLOBALS ['dbi ' ],
1678+ new Relation ($ GLOBALS ['dbi ' ]),
1679+ new Transformations (),
1680+ new FileListing (),
1681+ new Template ()
1682+ );
16431683 $ this ->insertEdit ->setSessionForEditNext ('`a` = 2 ' );
16441684
16451685 $ this ->assertEquals ('CONCAT(`table`.`orgname`) IS NULL ' , $ _SESSION ['edit_next ' ]);
@@ -1738,7 +1778,13 @@ public function testExecuteSqlQuery(): void
17381778 $ GLOBALS ['cfg ' ]['IgnoreMultiSubmitErrors ' ] = false ;
17391779 $ _POST ['submit_type ' ] = '' ;
17401780
1741- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
1781+ $ this ->insertEdit = new InsertEdit (
1782+ $ GLOBALS ['dbi ' ],
1783+ new Relation ($ GLOBALS ['dbi ' ]),
1784+ new Transformations (),
1785+ new FileListing (),
1786+ new Template ()
1787+ );
17421788 $ result = $ this ->insertEdit ->executeSqlQuery ([], $ query );
17431789
17441790 $ this ->assertEquals (['sql_query ' => 'SELECT * FROM `test_db`.`test_table`; ' ], $ result [0 ]);
@@ -1759,7 +1805,13 @@ public function testExecuteSqlQueryWithTryQuery(): void
17591805 $ GLOBALS ['cfg ' ]['IgnoreMultiSubmitErrors ' ] = true ;
17601806 $ _POST ['submit_type ' ] = '' ;
17611807
1762- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
1808+ $ this ->insertEdit = new InsertEdit (
1809+ $ GLOBALS ['dbi ' ],
1810+ new Relation ($ GLOBALS ['dbi ' ]),
1811+ new Transformations (),
1812+ new FileListing (),
1813+ new Template ()
1814+ );
17631815 $ result = $ this ->insertEdit ->executeSqlQuery ([], $ query );
17641816
17651817 $ this ->assertEquals (['sql_query ' => 'SELECT * FROM `test_db`.`test_table`; ' ], $ result [0 ]);
@@ -1786,7 +1838,13 @@ public function testGetWarningMessages(): void
17861838 ->will ($ this ->returnValue ($ warnings ));
17871839
17881840 $ GLOBALS ['dbi ' ] = $ dbi ;
1789- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
1841+ $ this ->insertEdit = new InsertEdit (
1842+ $ GLOBALS ['dbi ' ],
1843+ new Relation ($ GLOBALS ['dbi ' ]),
1844+ new Transformations (),
1845+ new FileListing (),
1846+ new Template ()
1847+ );
17901848
17911849 $ result = $ this ->callFunction (
17921850 $ this ->insertEdit ,
@@ -1831,7 +1889,13 @@ public function testGetDisplayValueForForeignTableColumn(): void
18311889 ->will ($ this ->returnValue ('2 ' ));
18321890
18331891 $ GLOBALS ['dbi ' ] = $ dbi ;
1834- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
1892+ $ this ->insertEdit = new InsertEdit (
1893+ $ GLOBALS ['dbi ' ],
1894+ new Relation ($ GLOBALS ['dbi ' ]),
1895+ new Transformations (),
1896+ new FileListing (),
1897+ new Template ()
1898+ );
18351899
18361900 $ result = $ this ->insertEdit ->getDisplayValueForForeignTableColumn ('=1 ' , $ map , 'f ' );
18371901
@@ -2054,7 +2118,13 @@ public function testGetCurrentValueAsAnArrayForMultipleEdit(): void
20542118 ->will ($ this ->returnValue ('uuid1234 ' ));
20552119
20562120 $ GLOBALS ['dbi ' ] = $ dbi ;
2057- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
2121+ $ this ->insertEdit = new InsertEdit (
2122+ $ GLOBALS ['dbi ' ],
2123+ new Relation ($ GLOBALS ['dbi ' ]),
2124+ new Transformations (),
2125+ new FileListing (),
2126+ new Template ()
2127+ );
20582128
20592129 $ result = $ this ->insertEdit ->getCurrentValueAsAnArrayForMultipleEdit (
20602130 $ multi_edit_funcs ,
@@ -2118,7 +2188,13 @@ public function testGetCurrentValueAsAnArrayForMultipleEdit(): void
21182188 */
21192189 public function testGetCurrentValueForDifferentTypes (): void
21202190 {
2121- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
2191+ $ this ->insertEdit = new InsertEdit (
2192+ $ GLOBALS ['dbi ' ],
2193+ new Relation ($ GLOBALS ['dbi ' ]),
2194+ new Transformations (),
2195+ new FileListing (),
2196+ new Template ()
2197+ );
21222198
21232199 $ result = $ this ->insertEdit ->getCurrentValueForDifferentTypes (
21242200 '123 ' ,
@@ -2355,7 +2431,13 @@ public function testVerifyWhetherValueCanBeTruncatedAndAppendExtraData(): void
23552431 ->will ($ this ->onConsecutiveCalls (false , '123 ' , '2013-08-28 06:34:14 ' ));
23562432
23572433 $ GLOBALS ['dbi ' ] = $ dbi ;
2358- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
2434+ $ this ->insertEdit = new InsertEdit (
2435+ $ GLOBALS ['dbi ' ],
2436+ new Relation ($ GLOBALS ['dbi ' ]),
2437+ new Transformations (),
2438+ new FileListing (),
2439+ new Template ()
2440+ );
23592441
23602442 $ this ->insertEdit ->verifyWhetherValueCanBeTruncatedAndAppendExtraData ('db ' , 'table ' , 'a ' , $ extra_data );
23612443
@@ -2394,7 +2476,13 @@ public function testGetTableColumns(): void
23942476 ]));
23952477
23962478 $ GLOBALS ['dbi ' ] = $ dbi ;
2397- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
2479+ $ this ->insertEdit = new InsertEdit (
2480+ $ GLOBALS ['dbi ' ],
2481+ new Relation ($ GLOBALS ['dbi ' ]),
2482+ new Transformations (),
2483+ new FileListing (),
2484+ new Template ()
2485+ );
23982486
23992487 $ result = $ this ->insertEdit ->getTableColumns ('db ' , 'table ' );
24002488
@@ -2442,7 +2530,13 @@ public function testDetermineInsertOrEdit(): void
24422530 $ response ->setAccessible (true );
24432531 $ response ->setValue ($ responseMock );
24442532
2445- $ this ->insertEdit = new InsertEdit ($ dbi );
2533+ $ this ->insertEdit = new InsertEdit (
2534+ $ GLOBALS ['dbi ' ],
2535+ new Relation ($ GLOBALS ['dbi ' ]),
2536+ new Transformations (),
2537+ new FileListing (),
2538+ new Template ()
2539+ );
24462540
24472541 $ result = $ this ->insertEdit ->determineInsertOrEdit ('1 ' , 'db ' , 'table ' );
24482542
@@ -2521,7 +2615,13 @@ public function testGetCommentsMap(): void
25212615 );
25222616
25232617 $ GLOBALS ['dbi ' ] = $ dbi ;
2524- $ this ->insertEdit = new InsertEdit ($ GLOBALS ['dbi ' ]);
2618+ $ this ->insertEdit = new InsertEdit (
2619+ $ GLOBALS ['dbi ' ],
2620+ new Relation ($ GLOBALS ['dbi ' ]),
2621+ new Transformations (),
2622+ new FileListing (),
2623+ new Template ()
2624+ );
25252625
25262626 $ this ->assertEquals (
25272627 [],
0 commit comments