Merge #20168 - Fix XML test on QA_5_2

Pull-request: #20168
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2026-02-24 09:29:25 +01:00
commit be24e8832c
No known key found for this signature in database
GPG Key ID: 70684F4717D49A31
2 changed files with 19 additions and 23 deletions

View File

@ -47077,7 +47077,7 @@ parameters:
-
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#"
count: 10
count: 5
path: test/classes/Plugins/Import/ImportXmlTest.php
-

View File

@ -79,7 +79,7 @@ class ImportXmlTest extends AbstractTestCase
public function testDoImport(): void
{
//$import_notice will show the import detail result
global $import_notice;
global $sql_query;
//Mock DBI
$dbi = $this->getMockBuilder(DatabaseInterface::class)
@ -93,28 +93,24 @@ class ImportXmlTest extends AbstractTestCase
//Test function called
$this->object->doImport($importHandle);
// If import successfully, PMA will show all databases and tables
// imported as following HTML Page
/*
The following structures have either been created or altered. Here you
can:
View a structure's contents by clicking on its name
Change any of its settings by clicking the corresponding "Options" link
Edit structure by following the "Structure" link
phpmyadmintest (Options)
pma_bookmarktest (Structure) (Options)
*/
//asset that all databases and tables are imported
self::assertStringContainsString(
'The following structures have either been created or altered.',
$import_notice
//assert that all sql are executed
self::assertSame(
'CREATE DATABASE IF NOT EXISTS `phpmyadmintest` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;;'
. 'USE `phpmyadmintest`;' . "\n"
. 'CREATE TABLE IF NOT EXISTS `pma_bookmarktest` (' . "\n"
. ' `id` int(11) NOT NULL AUTO_INCREMENT,' . "\n"
. ' `dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT \'\',' . "\n"
. ' `user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT \'\',' . "\n"
. ' `label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT \'\',' . "\n"
. ' `query` text COLLATE utf8_bin NOT NULL,' . "\n"
. ' PRIMARY KEY (`id`)' . "\n"
. ') ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT=\'Bookmarks\';' . "\n"
. ' ;'
. 'INSERT INTO `phpmyadmintest`.`pma_bookmarktest` (`id`, `dbase`, `user`, `label`, `query`) '
. 'VALUES (, \'\', \'\', \'\', \'\');;',
$sql_query
);
self::assertStringContainsString('Go to database: `phpmyadmintest`', $import_notice);
self::assertStringContainsString('Edit settings for `phpmyadmintest`', $import_notice);
self::assertStringContainsString('Go to table: `pma_bookmarktest`', $import_notice);
self::assertStringContainsString('Edit settings for `pma_bookmarktest`', $import_notice);
self::assertTrue($GLOBALS['finished']);
}