Skip to content
Snippets Groups Projects
Commit e4571a83 authored by Mantas Jonušas's avatar Mantas Jonušas
Browse files

Refactored percentile ranks aggregation

parent 5ac27999
No related branches found
No related tags found
No related merge requests found
...@@ -13,16 +13,53 @@ namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation; ...@@ -13,16 +13,53 @@ namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation;
use ONGR\ElasticsearchBundle\DSL\Aggregation\PercentileRanksAggregation; use ONGR\ElasticsearchBundle\DSL\Aggregation\PercentileRanksAggregation;
/**
* Percentile ranks aggregation unit tests.
*/
class PercentileRanksAggregationTest extends \PHPUnit_Framework_TestCase class PercentileRanksAggregationTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Tests if exception is thrown. * @var PercentileRanksAggregation
*/
public $agg;
/**
* Phpunit setup.
*/
public function setUp()
{
$this->agg = new PercentileRanksAggregation('foo');
}
/**
* Tests if exception is thrown when required parameters not set.
* *
* @expectedException \LogicException * @expectedException \LogicException
*/ */
public function testIfPercentileRanksAggregationThrowsAnException() public function testIfPercentileRanksAggregationThrowsAnException()
{ {
$agg = new PercentileRanksAggregation('foo'); $this->agg->toArray();
$agg->toArray(); }
/**
* Tests exception when only field is set.
*
* @expectedException \LogicException
*/
public function testIfExceptionIsThrownWhenFieldSetAndValueNotSet()
{
$this->agg->setField('bar');
$this->agg->toArray();
}
/**
* Tests exception when only value is set.
*
* @expectedException \LogicException
*/
public function testIfExceptionIsThrownWhenScriptSetAndValueNotSet()
{
$this->agg->setScript('bar');
$this->agg->toArray();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment