public function testOutputStatistics() { $semanticStatistics = array('PROPUSES' => 0, 'ERRORUSES' => 0, 'USEDPROPS' => 0, 'OWNPAGE' => 0, 'DECLPROPS' => 0, 'DELETECOUNT' => 0, 'SUBOBJECTS' => 0, 'QUERY' => 0, 'CONCEPTS' => 0); $this->store->expects($this->once())->method('getStatistics')->will($this->returnValue($semanticStatistics)); $this->outputFormatter->expects($this->atLeastOnce())->method('addHtml'); $instance = new LinkSection($this->htmlFormRenderer, $this->outputFormatter); $instance->outputStatistics(); }
/** * @see SpecialPage::execute */ public function execute($query) { if (!$this->userCanExecute($this->getUser())) { // $this->mRestriction is private MW 1.23- throw new ExtendedPermissionsError('smw-admin', array('smw-smwadmin-permission-missing')); } $output = $this->getOutput(); $output->setPageTitle(Message::get('smwadmin', Message::TEXT, Message::USER_LANGUAGE)); $applicationFactory = ApplicationFactory::getInstance(); $mwCollaboratorFactory = $applicationFactory->newMwCollaboratorFactory(); $htmlFormRenderer = $mwCollaboratorFactory->newHtmlFormRenderer($this->getContext()->getTitle(), $this->getLanguage()); $store = $applicationFactory->getStore(); $connection = $store->getConnection('mw.db'); $outputFormatter = new OutputFormatter($output); $dataRepairSection = new DataRepairSection($connection, $htmlFormRenderer, $outputFormatter); $dataRepairSection->enabledRefreshStore($applicationFactory->getSettings()->get('smwgAdminRefreshStore')); $linkSection = new LinkSection($htmlFormRenderer, $outputFormatter); $tableSchemaUpdaterSection = new TableSchemaUpdaterSection($store, $htmlFormRenderer, $outputFormatter); $tableSchemaUpdaterSection->enabledSetupStore($applicationFactory->getSettings()->get('smwgAdminSetupStore')); $idHandlerSection = new IdHandlerSection($connection, $htmlFormRenderer, $outputFormatter); $idHandlerSection->enabledIdDisposal($applicationFactory->getSettings()->get('smwgAdminIdDisposal')); $supportSection = new SupportSection($htmlFormRenderer); // Actions switch ($this->getRequest()->getText('action')) { case 'settings': return $linkSection->outputConfigurationList(); case 'stats': return $linkSection->outputStatistics(); case 'updatetables': return $tableSchemaUpdaterSection->doUpdate($this->getRequest()); case 'idlookup': return $idHandlerSection->outputActionForm($this->getRequest(), $this->getUser()); case 'refreshstore': return $dataRepairSection->doRefresh($this->getRequest()); } // General intro $html = Message::get('smw_smwadmin_docu', Message::TEXT, Message::USER_LANGUAGE); $html .= $tableSchemaUpdaterSection->getForm(); $html .= $dataRepairSection->getForm(); $html .= $linkSection->getForm(); $html .= $supportSection->getForm(); $output->addHTML($html); }