From 356af585444324e355dd43ae6ef98186a694433c Mon Sep 17 00:00:00 2001 From: Mantas <marc.mantas@gmail.com> Date: Tue, 12 Jul 2016 14:42:47 +0300 Subject: [PATCH] added geo centroid aggregation test --- .../GeoCentroidAggregationTest.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/Aggregation/GeoCentroidAggregationTest.php diff --git a/tests/Aggregation/GeoCentroidAggregationTest.php b/tests/Aggregation/GeoCentroidAggregationTest.php new file mode 100644 index 0000000..e8d6ea9 --- /dev/null +++ b/tests/Aggregation/GeoCentroidAggregationTest.php @@ -0,0 +1,49 @@ +<?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\ElasticsearchDSL\Tests\Aggregation; + +use ONGR\ElasticsearchDSL\Aggregation\GeoCentroidAggregation; + +/** + * Unit test for children aggregation. + */ +class GeoCentroidAggregationTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test if exception is thrown when field is not provided + * + * @expectedException \LogicException + */ + public function testGetArrayException() + { + $aggregation = new GeoCentroidAggregation('foo'); + $aggregation->getArray(); + } + + /** + * Tests getType method. + */ + public function testGeoCentroidAggregationGetType() + { + $aggregation = new GeoCentroidAggregation('foo'); + $this->assertEquals('geo_centroid', $aggregation->getType()); + } + + /** + * Tests getArray method. + */ + public function testGeoCentroidAggregationGetArray() + { + $aggregation = new GeoCentroidAggregation('foo', 'location'); + $this->assertEquals(['field' => 'location'], $aggregation->getArray()); + } +} -- GitLab