Code Duplication    Length = 12-13 lines in 3 locations

tests/Aggregation/GeohashGridTest.php 1 location

@@ 19-30 (lines=12) @@
16
    /**
17
     * @group functional
18
     */
19
    public function testGeohashGridAggregation(): 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
    protected function _getIndexForTest(): Index
33
    {

tests/Aggregation/TermsTest.php 2 locations

@@ 76-87 (lines=12) @@
73
        $this->assertSame(['first', 'second'], $agg->getParam('exclude'));
74
    }
75
76
    public function testTermsAggregation(): void
77
    {
78
        $agg = new Terms('terms');
79
        $agg->setField('color');
80
81
        $query = new Query();
82
        $query->addAggregation($agg);
83
        $results = $this->getIndex()->search($query)->getAggregation('terms');
84
85
        $this->assertEquals(2, $results['buckets'][0]['doc_count']);
86
        $this->assertEquals('blue', $results['buckets'][0]['key']);
87
    }
88
89
    public function testTermsWithMissingAggregation(): void
90
    {
@@ 89-101 (lines=13) @@
86
        $this->assertEquals('blue', $results['buckets'][0]['key']);
87
    }
88
89
    public function testTermsWithMissingAggregation(): void
90
    {
91
        $agg = new Terms('terms');
92
        $agg->setField('color');
93
        $agg->setMissing('blue');
94
95
        $query = new Query();
96
        $query->addAggregation($agg);
97
        $results = $this->getIndex()->search($query)->getAggregation('terms');
98
99
        $this->assertEquals(3, $results['buckets'][0]['doc_count']);
100
        $this->assertEquals('blue', $results['buckets'][0]['key']);
101
    }
102
103
    public function testTermsSetOrder(): void
104
    {