diff --git a/Aggregation/PercentileRanksAggregationTest.php b/Aggregation/PercentileRanksAggregationTest.php
index b19635b2683a085ce7d049cc153996e9f6b93fdb..a063b361372eb09a011d0654f1f0f8fdc183be59 100644
--- a/Aggregation/PercentileRanksAggregationTest.php
+++ b/Aggregation/PercentileRanksAggregationTest.php
@@ -13,16 +13,53 @@ namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation;
 
 use ONGR\ElasticsearchBundle\DSL\Aggregation\PercentileRanksAggregation;
 
+/**
+ * Percentile ranks aggregation unit tests.
+ */
 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
      */
     public function testIfPercentileRanksAggregationThrowsAnException()
     {
-        $agg = new PercentileRanksAggregation('foo');
-        $agg->toArray();
+        $this->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();
     }
 }