public function testCheckOnPostCreation() { $row = new \stdClass(); $row->smw_id = 42; $idTable = $this->getMockBuilder('\\stdClass')->setMethods(array('getPropertyInterwiki', 'moveSMWPageID'))->getMock(); $idTable->expects($this->any())->method('getPropertyInterwiki')->will($this->returnValue('Foo')); $connection = $this->getMockBuilder('\\SMW\\MediaWiki\\Database')->disableOriginalConstructor()->getMock(); $connection->expects($this->atLeastOnce())->method('selectRow')->will($this->returnValue($row)); $store = $this->getMockBuilder('\\SMW\\SQLStore\\SQLStore')->disableOriginalConstructor()->setMethods(array('getObjectIds', 'getConnection'))->getMock(); $store->expects($this->any())->method('getConnection')->will($this->returnValue($connection)); $store->expects($this->any())->method('getObjectIds')->will($this->returnValue($idTable)); $tableBuilder = $this->getMockBuilder('\\SMW\\SQLStore\\TableBuilder')->disableOriginalConstructor()->getMock(); $tableBuilder->expects($this->once())->method('checkOn'); $instance = new TableIntegrityExaminer($store); $instance->setMessageReporter($this->spyMessageReporter); $instance->checkOnPostCreation($tableBuilder); }
/** * @since 2.5 * * @param boolean $verbose */ public function install($verbose = true) { // If for some reason the enableSemantics was not yet enabled // still allow to run the tables create in order for the // setup to be completed if (CompatibilityMode::extensionNotEnabled()) { CompatibilityMode::enableTemporaryCliUpdateMode(); } $messageReporter = $this->newMessageReporter($verbose); $messageReporter->reportMessage("\nSelected storage engine is \"SMWSQLStore3\" (or an extension thereof)\n"); $messageReporter->reportMessage("\nSetting up standard database configuration for SMW ...\n\n"); $this->tableBuilder->setMessageReporter($messageReporter); $this->tableIntegrityExaminer->setMessageReporter($messageReporter); foreach ($this->tableSchemaManager->getTables() as $table) { $this->tableBuilder->create($table); } $this->tableIntegrityExaminer->checkOnPostCreation($this->tableBuilder); Hooks::run('SMW::SQLStore::AfterCreateTablesComplete', array($this->tableBuilder)); $messageReporter->reportMessage("\nDatabase initialized completed.\n" . ($this->isFromExtensionSchemaUpdate ? "\n" : '')); return true; }