diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/Maintenance/SetupStoreMaintenanceTest.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/Maintenance/SetupStoreMaintenanceTest.php | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/Maintenance/SetupStoreMaintenanceTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/Maintenance/SetupStoreMaintenanceTest.php new file mode 100644 index 00000000..9cc9ce0b --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/Maintenance/SetupStoreMaintenanceTest.php @@ -0,0 +1,83 @@ +<?php + +namespace SMW\Tests\Integration\MediaWiki\Maintenance; + +use SMW\Tests\MwDBaseUnitTestCase; + +/** + * @group semantic-mediawiki-integration + * @group medium + * + * @license GNU GPL v2+ + * @since 2.0 + * + * @author mwjames + */ +class SetupStoreMaintenanceTest extends MwDBaseUnitTestCase { + + protected $destroyDatabaseTablesAfterRun = true; + + private $importedTitles = []; + private $runnerFactory; + private $titleValidator; + private $spyMessageReporter; + + protected function setUp() { + parent::setUp(); + + $this->runnerFactory = $this->testEnvironment->getUtilityFactory()->newRunnerFactory(); + $this->titleValidator = $this->testEnvironment->getUtilityFactory()->newValidatorFactory()->newTitleValidator(); + $this->spyMessageReporter = $this->testEnvironment->getUtilityFactory()->newSpyMessageReporter(); + + $importRunner = $this->runnerFactory->newXmlImportRunner( + __DIR__ . '/Fixtures/test-import-19.7.xml' + ); + + if ( !$importRunner->setVerbose( true )->run() ) { + $importRunner->reportFailedImport(); + $this->markTestIncomplete( 'Test was marked as incomplete because the data import failed' ); + } + } + + protected function tearDown() { + $this->testEnvironment->flushPages( $this->importedTitles ); + parent::tearDown(); + } + + public function testSetupStore() { + + $this->importedTitles = [ + 'Category:Lorem ipsum', + 'Lorem ipsum', + 'Elit Aliquam urna interdum', + 'Platea enim hendrerit', + 'Property:Has Url', + 'Property:Has annotation uri', + 'Property:Has boolean', + 'Property:Has date', + 'Property:Has email', + 'Property:Has number', + 'Property:Has page', + 'Property:Has quantity', + 'Property:Has temperature', + 'Property:Has text' + ]; + + $this->titleValidator->assertThatTitleIsKnown( $this->importedTitles ); + + $maintenanceRunner = $this->runnerFactory->newMaintenanceRunner( 'SMW\Maintenance\SetupStore' ); + + $maintenanceRunner->setMessageReporter( + $this->spyMessageReporter + ); + + $maintenanceRunner->setQuiet(); + $maintenanceRunner->run(); + + $this->assertContains( + 'Database initialized completed', + $this->spyMessageReporter->getMessagesAsString() + ); + } + +} |