public function searchIndex()
 {
     global $wgRequest, $wgSitename, $wgUser;
     $lang = $this->helper->getLangForSearchResults();
     $centralUrl = $this->helper->getCentralUrlFromGlobalTitle($lang);
     $globalSearchUrl = $this->helper->getGlobalSearchUrl($centralUrl);
     $localSearchUrl = SpecialPage::getTitleFor('Search')->getFullUrl();
     $fulltext = $wgUser->getGlobalPreference('enableGoSearch') ? 0 : 'Search';
     $query = $wgRequest->getVal('search', $wgRequest->getVal('query', ''));
     $localSearchPlaceholder = html_entity_decode(wfMessage('global-navigation-local-search-placeholder', $wgSitename)->parse());
     if (WikiaPageType::isCorporatePage() && !WikiaPageType::isWikiaHub()) {
         $this->response->setVal('disableLocalSearchOptions', true);
         $this->response->setVal('defaultSearchPlaceholder', wfMessage('global-navigation-global-search')->escaped());
         $this->response->setVal('defaultSearchUrl', $globalSearchUrl);
     } else {
         $this->response->setVal('globalSearchUrl', $globalSearchUrl);
         $this->response->setVal('localSearchUrl', $localSearchUrl);
         $this->response->setVal('localSearchPlaceholder', $localSearchPlaceholder);
         $this->response->setVal('defaultSearchPlaceholder', $localSearchPlaceholder);
         $this->response->setVal('defaultSearchUrl', $localSearchUrl);
     }
     $this->response->setVal('fulltext', $fulltext);
     $this->response->setVal('query', $query);
     $this->response->setVal('lang', $lang);
 }
 public function testGetLangForSearchResultsIfResultsLangNotSet()
 {
     $wgRequestMock = $this->getMock('WebRequest', ['getVal']);
     $wgRequestMock->expects($this->any())->method('getVal')->will($this->returnValue(null));
     $this->mockGlobalVariable('wgRequest', $wgRequestMock);
     $this->mockGlobalVariable('wgLanguageCode', 'bar');
     $globalNavHelper = new GlobalNavigationHelper();
     $this->assertEquals($globalNavHelper->getLangForSearchResults(), 'bar');
 }