From 642af5b651589d0415c97f79f97b6b07ca70943e Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Thu, 9 Jul 2015 15:57:35 +0300 Subject: [PATCH] Test constructor arguments to GeoDistanceAggregationTest. --- .../GeoDistanceAggregationTest.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/Aggregation/GeoDistanceAggregationTest.php b/tests/Aggregation/GeoDistanceAggregationTest.php index 0379ab0..19ab699 100644 --- a/tests/Aggregation/GeoDistanceAggregationTest.php +++ b/tests/Aggregation/GeoDistanceAggregationTest.php @@ -112,4 +112,42 @@ class GeoDistanceAggregationTest extends \PHPUnit_Framework_TestCase $result = $aggregation->getType(); $this->assertEquals('geo_distance', $result); } + + /** + * Tests if parameters can be passed to constructor. + */ + public function testConstructorFilter() + { + $aggregation = new GeoDistanceAggregation( + 'test', + 'fieldName', + 'originValue', + [ + ['from' => 'value'], + ['to' => 'value'], + ['from' => 'value', 'to' => 'value2'], + ], + 'unitValue', + 'distanceTypeValue' + ); + + $this->assertSame( + [ + 'agg_test' => [ + 'geo_distance' => [ + 'field' => 'fieldName', + 'origin' => 'originValue', + 'unit' => 'unitValue', + 'distance_type' => 'distanceTypeValue', + 'ranges' => [ + ['from' => 'value'], + ['to' => 'value'], + ['from' => 'value', 'to' => 'value2'], + ], + ], + ], + ], + $aggregation->toArray() + ); + } } -- GitLab