From 0edc8d47f210a771a5fa6cb22a18dba434bbd9fc Mon Sep 17 00:00:00 2001
From: Ivannis Suarez Jerez <ivannis.suarez@gmail.com>
Date: Sat, 29 Nov 2014 13:02:41 +0000
Subject: [PATCH] added nested_aggregation unit test

---
 Aggregation/NestedAggregationTest.php | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 Aggregation/NestedAggregationTest.php

diff --git a/Aggregation/NestedAggregationTest.php b/Aggregation/NestedAggregationTest.php
new file mode 100644
index 0000000..98b9379
--- /dev/null
+++ b/Aggregation/NestedAggregationTest.php
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation;
+
+use ONGR\ElasticsearchBundle\DSL\Aggregation\NestedAggregation;
+
+class NestedAggregationTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test for nested aggregation toArray() method.
+     */
+    public function testToArray()
+    {
+        $aggregation = new NestedAggregation('test_agg');
+        $aggregation->setPath('test_path');
+
+        $expectedResult = [
+            'agg_test_agg' => [
+                'nested' => ['path' => 'test_path'],
+            ],
+        ];
+
+        $this->assertEquals($expectedResult, $aggregation->toArray());
+    }
+}
-- 
GitLab