Code Duplication    Length = 7-9 lines in 2 locations

tests/Aggregation/IpRangeTest.php 1 location

@@ 32-40 (lines=9) @@
29
        $query->addAggregation($agg);
30
        $results = $this->_getIndexForTest()->search($query)->getAggregation('ip');
31
32
        foreach ($results['buckets'] as $bucket) {
33
            if (\array_key_exists('key', $bucket) && $bucket['key'] == $cidrRange) {
34
                // the CIDR mask
35
                $this->assertEquals(3, $bucket['doc_count']);
36
            } else {
37
                // the normal ip ranges
38
                $this->assertEquals(2, $bucket['doc_count']);
39
            }
40
        }
41
    }
42
43
    protected function _getIndexForTest(): Index

tests/Aggregation/DateRangeTest.php 1 location

@@ 49-55 (lines=7) @@
46
        $query->addAggregation($agg);
47
        $results = $this->_getIndexForTest()->search($query)->getAggregation('date');
48
49
        foreach ($results['buckets'] as $bucket) {
50
            if (\array_key_exists('to', $bucket)) {
51
                $this->assertEquals(1, $bucket['doc_count']);
52
            } elseif (\array_key_exists('from', $bucket)) {
53
                $this->assertEquals(2, $bucket['doc_count']);
54
            }
55
        }
56
    }
57
58
    /**