Merge branch 'QA_5_2'
Fixes #18930 Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
commit
09cf21915e
@ -1011,6 +1011,10 @@ class Import
|
||||
$numCols = count($table->columns);
|
||||
$lastColumnKey = array_key_last($table->columns);
|
||||
|
||||
if ($table->rows === []) {
|
||||
break;
|
||||
}
|
||||
|
||||
$tempSQLStr = 'INSERT INTO ' . Util::backquote($dbName) . '.'
|
||||
. Util::backquote($table->tableName) . ' (';
|
||||
|
||||
|
||||
@ -138,4 +138,48 @@ class ImportMediawikiTest extends AbstractTestCase
|
||||
self::assertStringContainsString('Edit settings for `pma_bookmarktest`', ImportSettings::$importNotice);
|
||||
self::assertTrue(ImportSettings::$finished);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for doImport
|
||||
*
|
||||
* @group medium
|
||||
*/
|
||||
public function testDoImportWithEmptyTable(): void
|
||||
{
|
||||
//Mock DBI
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$importHandle = new File('tests/test_data/__slashes.mediawiki');
|
||||
$importHandle->open();
|
||||
|
||||
//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
|
||||
|
||||
mediawiki_DB (Options)
|
||||
pma_bookmarktest (Structure) (Options)
|
||||
*/
|
||||
|
||||
//asset that all databases and tables are imported
|
||||
self::assertStringContainsString(
|
||||
'The following structures have either been created or altered.',
|
||||
ImportSettings::$importNotice,
|
||||
);
|
||||
self::assertStringContainsString('Go to database: `mediawiki_DB`', ImportSettings::$importNotice);
|
||||
self::assertStringContainsString('Edit settings for `mediawiki_DB`', ImportSettings::$importNotice);
|
||||
self::assertStringContainsString('Go to table: `empty`', ImportSettings::$importNotice);
|
||||
self::assertStringContainsString('Edit settings for `empty`', ImportSettings::$importNotice);
|
||||
self::assertTrue(ImportSettings::$finished);
|
||||
}
|
||||
}
|
||||
|
||||
12
tests/test_data/__slashes.mediawiki
Normal file
12
tests/test_data/__slashes.mediawiki
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
<!--
|
||||
Table data for `empty`
|
||||
-->
|
||||
|
||||
{| class="wikitable sortable" style="text-align:center;"
|
||||
|+'''empty'''
|
||||
|-
|
||||
! \'table
|
||||
! \\column
|
||||
|}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user