Пример #1
0
 /**
  * @group Slow
  * @slowExecutionTime 0.07158 ms
  * @covers \Wikia\Search\Config::getSort
  * @covers \Wikia\Search\Config::setSort
  */
 public function testGetSort()
 {
     $config = new \Wikia\Search\Config();
     $defaultRank = array('score', Solarium_Query_Select::SORT_DESC);
     $this->assertEquals($defaultRank, $config->getSort(), 'Search config should sort by score descending by default.');
     $config->setRank('foo');
     $this->assertEquals($defaultRank, $config->getSort(), 'A malformed rank key should return the default sort.');
     $config->setRank('newest');
     $this->assertEquals(array('created', Solarium_Query_Select::SORT_DESC), $config->getSort(), 'A well-formed rank key should return the appropriate sort array.');
     $set = new ReflectionMethod($config, 'setSort');
     $set->setAccessible(true);
     $set->invoke($config, 'created', 'asc');
     $this->assertEquals(array('created', 'asc'), $config->getSort(), '\\Wikia\\Search\\Config::getSort should return a value set by setSort if it has been invoked');
 }