Commit 1ad41093 authored by Bas de Nooijer's avatar Bas de Nooijer

Fixed unittests

parent 2a9ffab2
...@@ -72,7 +72,7 @@ class MultiQuery extends Facet ...@@ -72,7 +72,7 @@ class MultiQuery extends Facet
switch ($name) { switch ($name) {
case 'query': case 'query':
if (!is_array($value)) { if (!is_array($value)) {
$value = array($value); $value = array(array('query' => $value));
} }
$this->addQueries($value); $this->addQueries($value);
break; break;
......
...@@ -79,4 +79,11 @@ class WeightedRandomChoiceTest extends \PHPUnit_Framework_TestCase ...@@ -79,4 +79,11 @@ class WeightedRandomChoiceTest extends \PHPUnit_Framework_TestCase
$randomizer->getRandom($excludes); $randomizer->getRandom($excludes);
} }
public function testInvalidWeigth()
{
$choices = array('key1' => -1, 'key2' => 2);
$this->setExpectedException('Solarium\Core\Exception');
new WeightedRandomChoice($choices);
}
} }
\ No newline at end of file
...@@ -79,6 +79,17 @@ class MultiQueryTest extends \PHPUnit_Framework_TestCase ...@@ -79,6 +79,17 @@ class MultiQueryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('category:2', $query2->getQuery()); $this->assertEquals('category:2', $query2->getQuery());
} }
public function testConfigModeSingleQuery()
{
$options = array(
'query' => 'category:2'
);
$this->facet->setOptions($options);
$this->assertEquals('category:2', $this->facet->getQuery(0)->getQuery());
}
public function testGetType() public function testGetType()
{ {
$this->assertEquals( $this->assertEquals(
......
...@@ -59,6 +59,12 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase ...@@ -59,6 +59,12 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($this->collations[1], $this->result->getCollation()); $this->assertEquals($this->collations[1], $this->result->getCollation());
} }
public function testGetCollationWithoutData()
{
$result = new Result($this->suggestions, array(), $this->correctlySpelled);
$this->assertEquals(null, $result->getCollation());
}
public function testGetCollationWithKey() public function testGetCollationWithKey()
{ {
$this->assertEquals($this->collations[0], $this->result->getCollation(0)); $this->assertEquals($this->collations[0], $this->result->getCollation(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment