public function testGetForm()
 {
     $methods = array('setName', 'setMethod', 'addHiddenField', 'addHeader', 'addParagraph', 'addSubmitButton', 'setActionUrl');
     foreach ($methods as $method) {
         $this->htmlFormRenderer->expects($this->any())->method($method)->will($this->returnSelf());
     }
     $this->htmlFormRenderer->expects($this->atLeastOnce())->method('getForm');
     $instance = new SupportSection($this->htmlFormRenderer);
     $instance->getForm();
 }
Пример #2
0
 /**
  * @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);
 }