Code Duplication    Length = 12-13 lines in 4 locations

tests/Aggregation/TermsTest.php 2 locations

@@ 77-88 (lines=12) @@
74
    /**
75
     * @group functional
76
     */
77
    public function testTermsAggregation(): void
78
    {
79
        $agg = new Terms('terms');
80
        $agg->setField('color');
81
82
        $query = new Query();
83
        $query->addAggregation($agg);
84
        $results = $this->getIndex()->search($query)->getAggregation('terms');
85
86
        $this->assertEquals(2, $results['buckets'][0]['doc_count']);
87
        $this->assertEquals('blue', $results['buckets'][0]['key']);
88
    }
89
90
    /**
91
     * @group functional
@@ 106-118 (lines=13) @@
103
        $this->assertEquals('blue', $results['buckets'][2]['key']);
104
    }
105
106
    public function testTermsWithMissingAggregation(): void
107
    {
108
        $agg = new Terms('terms');
109
        $agg->setField('color');
110
        $agg->setMissing('blue');
111
112
        $query = new Query();
113
        $query->addAggregation($agg);
114
        $results = $this->getIndex()->search($query)->getAggregation('terms');
115
116
        $this->assertEquals(3, $results['buckets'][0]['doc_count']);
117
        $this->assertEquals('blue', $results['buckets'][0]['key']);
118
    }
119
120
    /**
121
     * @group functional

tests/Aggregation/GeohashGridTest.php 2 locations

@@ 19-30 (lines=12) @@
16
    /**
17
     * @group functional
18
     */
19
    public function testGeohashGridAggregationWithNumericalPrecision(): void
20
    {
21
        $agg = new GeohashGrid('hash', 'location');
22
        $agg->setPrecision(3);
23
24
        $query = new Query();
25
        $query->addAggregation($agg);
26
        $results = $this->_getIndexForTest()->search($query)->getAggregation('hash');
27
28
        $this->assertEquals(2, $results['buckets'][0]['doc_count']);
29
        $this->assertEquals(1, $results['buckets'][1]['doc_count']);
30
    }
31
32
    /**
33
     * @group functional
@@ 35-46 (lines=12) @@
32
    /**
33
     * @group functional
34
     */
35
    public function testGeohashGridAggregationWithDistancePrecision(): void
36
    {
37
        $agg = new GeohashGrid('hash', 'location');
38
        $agg->setPrecision('100km');
39
40
        $query = new Query();
41
        $query->addAggregation($agg);
42
        $results = $this->_getIndexForTest()->search($query)->getAggregation('hash');
43
44
        $this->assertEquals(2, $results['buckets'][0]['doc_count']);
45
        $this->assertEquals(1, $results['buckets'][1]['doc_count']);
46
    }
47
48
    /**
49
     * @group unit