Beispiel #1
0
 /**
  * @group Slow
  * @slowExecutionTime 0.18868 ms
  * @covers \Wikia\Search\Config::getSearchProfiles
  */
 public function testGetSearchProfiles()
 {
     $config = new Config();
     $searchEngineMock = $this->getMock('SearchEngine', array('defaultNamespaces', 'searchableNamespaces', 'namespacesAsText'), array());
     $this->getStaticMethodMock('SearchEngine', 'searchableNamespaces')->expects($this->any())->method('searchableNamespaces')->will($this->returnValue(array(NS_MAIN, NS_TALK, NS_CATEGORY, NS_FILE, NS_USER)));
     $this->getStaticMethodMock('SearchEngine', 'defaultNamespaces')->expects($this->any())->method('defaultNamespaces')->will($this->returnValue(array(NS_FILE, NS_CATEGORY)));
     $this->getStaticMethodMock('SearchEngine', 'namespacesAsText')->expects($this->any())->method('namespacesAsText')->will($this->returnValue(array('Article', 'Category')));
     $this->mockClass('SearchEngine', $searchEngineMock);
     $profiles = $config->getSearchProfiles();
     $profileConstants = array(SEARCH_PROFILE_DEFAULT, SEARCH_PROFILE_IMAGES, SEARCH_PROFILE_USERS, SEARCH_PROFILE_ALL);
     foreach ($profileConstants as $profile) {
         $this->assertArrayHasKey($profile, $profiles);
     }
 }