Code Duplication    Length = 16-17 lines in 2 locations

tests/Aggregation/ExtendedStatsTest.php 1 location

@@ 38-54 (lines=17) @@
35
    /**
36
     * @group functional
37
     */
38
    public function testExtendedStatsAggregationWithMissing(): void
39
    {
40
        $agg = new ExtendedStats('stats');
41
        $agg->setField('price');
42
        $agg->setMissing(10);
43
44
        $query = new Query();
45
        $query->addAggregation($agg);
46
        $results = $this->_getIndexForTest()->search($query)->getAggregation('stats');
47
48
        $this->assertEquals(5, $results['count']);
49
        $this->assertEquals(1, $results['min']);
50
        $this->assertEquals(10, $results['max']);
51
        $this->assertEquals((5 + 8 + 1 + 3 + 10) / 5.0, $results['avg']);
52
        $this->assertEquals((5 + 8 + 1 + 3 + 10), $results['sum']);
53
        $this->assertArrayHasKey('sum_of_squares', $results);
54
    }
55
56
    protected function _getIndexForTest(): Index
57
    {

tests/Aggregation/StatsTest.php 1 location

@@ 37-52 (lines=16) @@
34
    /**
35
     * @group functional
36
     */
37
    public function testStatsAggregationWithMissing(): void
38
    {
39
        $agg = new Stats('stats');
40
        $agg->setField('price');
41
        $agg->setMissing(10);
42
43
        $query = new Query();
44
        $query->addAggregation($agg);
45
        $results = $this->_getIndexForTest()->search($query)->getAggregation('stats');
46
47
        $this->assertEquals(5, $results['count']);
48
        $this->assertEquals(1, $results['min']);
49
        $this->assertEquals(10, $results['max']);
50
        $this->assertEquals((5 + 8 + 1 + 3 + 10) / 5.0, $results['avg']);
51
        $this->assertEquals((5 + 8 + 1 + 3 + 10), $results['sum']);
52
    }
53
54
    protected function _getIndexForTest(): Index
55
    {