getImportMediawiki(); $properties = $importMediawiki->getProperties(); self::assertSame( __('MediaWiki Table'), $properties->getText(), ); self::assertSame( 'txt', $properties->getExtension(), ); self::assertSame( 'text/plain', $properties->getMimeType(), ); self::assertNull($properties->getOptions()); } /** * Test for doImport */ public function testDoImport(): void { $dbi = $this->createStub(DatabaseInterface::class); $importHandle = new File(ImportSettings::$importFile); $importHandle->open(); $importMediawiki = $this->getImportMediawiki($dbi); //Test function called $importMediawiki->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: `pma_bookmarktest`', ImportSettings::$importNotice); self::assertStringContainsString('Edit settings for `pma_bookmarktest`', ImportSettings::$importNotice); self::assertTrue(ImportSettings::$finished); } public function testDoImportWithEmptyTable(): void { $dbi = $this->createStub(DatabaseInterface::class); $importHandle = new File('tests/test_data/__slashes.mediawiki'); $importHandle->open(); $importMediawiki = $this->getImportMediawiki($dbi); //Test function called $importMediawiki->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); } private function getImportMediawiki(DatabaseInterface|null $dbi = null): ImportMediawiki { $dbiObject = $dbi ?? $this->createDatabaseInterface(); $config = new Config(); return new ImportMediawiki(new Import($dbiObject, new ResponseRenderer(), $config), $dbiObject, $config); } }