diff options
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/GlobalAggregationTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/GlobalAggregationTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/GlobalAggregationTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/GlobalAggregationTest.php new file mode 100644 index 00000000..80366f50 --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/GlobalAggregationTest.php @@ -0,0 +1,27 @@ +<?php + +namespace Elastica\Test\Aggregation; + + +use Elastica\Aggregation\Avg; +use Elastica\Aggregation\GlobalAggregation; + +class GlobalAggregationTest extends BaseAggregationTest +{ + public function testToArray() + { + $expected = array( + "global" => new \stdClass(), + "aggs" => array( + "avg_price" => array("avg" => array("field" => "price")) + ) + ); + + $agg = new GlobalAggregation("all_products"); + $avg = new Avg("avg_price"); + $avg->setField("price"); + $agg->addAggregation($avg); + $this->assertEquals($expected, $agg->toArray()); + } +} +
\ No newline at end of file |