Code Duplication    Length = 12-14 lines in 3 locations

tests/Aggregation/NestedTest.php 1 location

@@ 20-33 (lines=14) @@
17
    /**
18
     * @group functional
19
     */
20
    public function testNestedAggregation(): void
21
    {
22
        $agg = new Nested('resellers', 'resellers');
23
        $min = new Min('min_price');
24
        $min->setField('resellers.price');
25
        $agg->addAggregation($min);
26
27
        $query = new Query();
28
        $query->addAggregation($agg);
29
30
        $results = $this->_getIndexForTest()->search($query)->getAggregation('resellers');
31
32
        $this->assertEquals(4.98, $results['min_price']['value']);
33
    }
34
35
    protected function _getIndexForTest(): Index
36
    {

tests/Aggregation/RangeTest.php 1 location

@@ 18-29 (lines=12) @@
15
    /**
16
     * @group functional
17
     */
18
    public function testRangeAggregation(): void
19
    {
20
        $agg = new Range('range');
21
        $agg->setField('price');
22
        $agg->addRange(1.5, 5);
23
24
        $query = new Query();
25
        $query->addAggregation($agg);
26
        $results = $this->_getIndexForTest()->search($query)->getAggregation('range');
27
28
        $this->assertEquals(2, $results['buckets'][0]['doc_count']);
29
    }
30
31
    /**
32
     * @group functional

tests/Aggregation/TermsTest.php 1 location

@@ 93-104 (lines=12) @@
90
    /**
91
     * @group functional
92
     */
93
    public function testTermsSetOrder(): void
94
    {
95
        $agg = new Terms('terms');
96
        $agg->setField('color');
97
        $agg->setOrder('_count', 'asc');
98
99
        $query = new Query();
100
        $query->addAggregation($agg);
101
        $results = $this->getIndex()->search($query)->getAggregation('terms');
102
103
        $this->assertEquals('blue', $results['buckets'][2]['key']);
104
    }
105
106
    public function testTermsWithMissingAggregation(): void
107
    {