Backport XML tests for no database (#20153) and improve GIS test
From: 7985b04f2d
Pull-request: #20170
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
4c0760bf5d
commit
a59be33d71
@ -115,12 +115,12 @@ class ImportXmlTest extends AbstractTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for doImport using second dataset
|
||||
* Test for doImport using the GIS dataset
|
||||
*
|
||||
* @group medium
|
||||
* @requires extension simplexml
|
||||
*/
|
||||
public function testDoImportDataset2(): void
|
||||
public function testDoImportDatasetGIS(): void
|
||||
{
|
||||
global $import_notice;
|
||||
|
||||
@ -129,7 +129,7 @@ class ImportXmlTest extends AbstractTestCase
|
||||
->getMock();
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$GLOBALS['import_file'] = 'test/test_data/test.xml';
|
||||
$GLOBALS['import_file'] = 'test/test_data/phpmyadmin_importXML_GIS_For_Testing.xml';
|
||||
|
||||
$importHandle = new File($GLOBALS['import_file']);
|
||||
$importHandle->open();
|
||||
@ -146,4 +146,37 @@ class ImportXmlTest extends AbstractTestCase
|
||||
self::assertStringContainsString('Edit settings for `test`', $import_notice);
|
||||
self::assertTrue($GLOBALS['finished']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for doImport using no database dataset
|
||||
*
|
||||
* @group medium
|
||||
* @requires extension simplexml
|
||||
*/
|
||||
public function testDoImportDatasetNoDatabase(): void
|
||||
{
|
||||
global $import_notice;
|
||||
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$GLOBALS['import_file'] = 'test/test_data/phpmyadmin_importXML_No_Database_For_Testing.xml';
|
||||
|
||||
$importHandle = new File($GLOBALS['import_file']);
|
||||
$importHandle->open();
|
||||
|
||||
$this->object->doImport($importHandle);
|
||||
|
||||
self::assertStringContainsString(
|
||||
'The following structures have either been created or altered.',
|
||||
$import_notice
|
||||
);
|
||||
self::assertStringContainsString('Go to database: `test25`', $import_notice);
|
||||
self::assertStringContainsString('Edit settings for `test`', $import_notice);
|
||||
self::assertStringContainsString('Go to table: `test`', $import_notice);
|
||||
self::assertStringContainsString('Edit settings for `test`', $import_notice);
|
||||
self::assertTrue($GLOBALS['finished']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pma_xml_export version="1.0" xmlns:pma="https://www.phpmyadmin.net/some_doc_url/">
|
||||
<pma:structure_schemas>
|
||||
<pma:database name="test25" collation="utf8mb4_general_ci" charset="utf8mb4">
|
||||
<pma:table name="test">
|
||||
CREATE TABLE `test` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
</pma:table>
|
||||
</pma:database>
|
||||
</pma:structure_schemas>
|
||||
</pma_xml_export>
|
||||
Loading…
Reference in New Issue
Block a user