tests/Aggregation/DateRangeTest.php 1 location
|
@@ 62-76 (lines=15) @@
|
| 59 |
|
/** |
| 60 |
|
* @group functional |
| 61 |
|
*/ |
| 62 |
|
public function testDateRangeKeyedAggregation(): void |
| 63 |
|
{ |
| 64 |
|
$agg = new DateRange('date'); |
| 65 |
|
$agg->setField('created'); |
| 66 |
|
$agg->setKeyed(); |
| 67 |
|
$agg->addRange(1390958535000)->addRange(null, 1390958535000); |
| 68 |
|
|
| 69 |
|
$query = new Query(); |
| 70 |
|
$query->addAggregation($agg); |
| 71 |
|
$results = $this->_getIndexForTest()->search($query)->getAggregation('date'); |
| 72 |
|
|
| 73 |
|
$expected = [ |
| 74 |
|
]; |
| 75 |
|
$this->assertSame($expected, \array_keys($results['buckets'])); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
/** |
| 79 |
|
* @group functional |
tests/Aggregation/HistogramTest.php 1 location
|
@@ 36-49 (lines=14) @@
|
| 33 |
|
/** |
| 34 |
|
* @group functional |
| 35 |
|
*/ |
| 36 |
|
public function testHistogramKeyedAggregation(): void |
| 37 |
|
{ |
| 38 |
|
$agg = new Histogram('hist', 'price', 10); |
| 39 |
|
$agg->setMinimumDocumentCount(0); // should return empty buckets |
| 40 |
|
$agg->setKeyed(); |
| 41 |
|
|
| 42 |
|
$query = new Query(); |
| 43 |
|
$query->addAggregation($agg); |
| 44 |
|
$results = $this->_getIndexForTest()->search($query)->getAggregation('hist'); |
| 45 |
|
|
| 46 |
|
$expected = [ |
| 47 |
|
]; |
| 48 |
|
$this->assertSame($expected, \array_keys($results['buckets'])); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
protected function _getIndexForTest(): Index |
| 52 |
|
{ |
tests/Aggregation/RangeTest.php 1 location
|
@@ 34-48 (lines=15) @@
|
| 31 |
|
/** |
| 32 |
|
* @group functional |
| 33 |
|
*/ |
| 34 |
|
public function testRangeKeyedAggregation(): void |
| 35 |
|
{ |
| 36 |
|
$agg = new Range('range'); |
| 37 |
|
$agg->setField('price'); |
| 38 |
|
$agg->addRange(1.5, 5); |
| 39 |
|
$agg->setKeyed(); |
| 40 |
|
|
| 41 |
|
$query = new Query(); |
| 42 |
|
$query->addAggregation($agg); |
| 43 |
|
$results = $this->_getIndexForTest()->search($query)->getAggregation('range'); |
| 44 |
|
|
| 45 |
|
$expected = [ |
| 46 |
|
]; |
| 47 |
|
$this->assertSame($expected, \array_keys($results['buckets'])); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
/** |
| 51 |
|
* @group unit |