Code Duplication    Length = 17-19 lines in 2 locations

tests/Aggregation/DateHistogramTest.php 1 location

@@ 45-61 (lines=17) @@
42
    /**
43
     * @group functional
44
     */
45
    public function testDateHistogramKeyedAggregation(): void
46
    {
47
        $agg = new DateHistogram('hist', 'created', '1h');
48
        $agg->setKeyed();
49
50
        $query = new Query();
51
        $query->addAggregation($agg);
52
        $results = $this->_getIndexForTest()->search($query)->getAggregation('hist');
53
54
        $expected = [
55
            '2014-01-29T00:00:00.000Z',
56
            '2014-01-29T01:00:00.000Z',
57
            '2014-01-29T02:00:00.000Z',
58
            '2014-01-29T03:00:00.000Z',
59
        ];
60
        $this->assertSame($expected, \array_keys($results['buckets']));
61
    }
62
63
    /**
64
     * @group unit

tests/Aggregation/HistogramTest.php 1 location

@@ 36-54 (lines=19) @@
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
            '0.0',
48
            '10.0',
49
            '20.0',
50
            '30.0',
51
            '40.0',
52
        ];
53
        $this->assertSame($expected, \array_keys($results['buckets']));
54
    }
55
56
    protected function _getIndexForTest(): Index
57
    {