blob: 6ab086d0c12ad78d9a29a06e160d1f1e5d2881f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php
namespace Elastica\Test\Aggregation;
use Elastica\Aggregation\Avg;
use Elastica\Aggregation\GlobalAggregation;
class GlobalAggregationTest extends BaseAggregationTest
{
/**
* @group unit
*/
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());
}
}
|