Code Duplication    Length = 17-17 lines in 4 locations

tests/Aggregation/GeoBoundsTest.php 1 location

@@ 33-49 (lines=17) @@
30
        $this->assertEquals(-117.24664804526, $results['bounds']['bottom_right']['lon']);
31
    }
32
33
    private function getIndexForTest(): Index
34
    {
35
        $index = $this->_createIndex();
36
        $index->setMapping(new Mapping([
37
            'location' => ['type' => 'geo_point'],
38
        ]));
39
40
        $index->addDocuments([
41
            new Document(1, ['location' => ['lat' => 32.849437, 'lon' => -117.271732]]),
42
            new Document(2, ['location' => ['lat' => 32.798320, 'lon' => -117.246648]]),
43
            new Document(3, ['location' => ['lat' => 37.782439, 'lon' => -122.392560]]),
44
        ]);
45
46
        $index->refresh();
47
48
        return $index;
49
    }
50
}
51

tests/Aggregation/GeoCentroidTest.php 1 location

@@ 30-46 (lines=17) @@
27
        $this->assertEquals(3, $results['count']);
28
    }
29
30
    protected function _getIndexForTest(): Index
31
    {
32
        $index = $this->_createIndex();
33
        $index->setMapping(new Mapping([
34
            'location' => ['type' => 'geo_point'],
35
        ]));
36
37
        $index->addDocuments([
38
            new Document(1, ['location' => ['lat' => 32.849437, 'lon' => -117.271732]]),
39
            new Document(2, ['location' => ['lat' => 32.798320, 'lon' => -117.246648]]),
40
            new Document(3, ['location' => ['lat' => 37.782439, 'lon' => -122.392560]]),
41
        ]);
42
43
        $index->refresh();
44
45
        return $index;
46
    }
47
}
48

tests/Aggregation/GeohashGridTest.php 1 location

@@ 32-48 (lines=17) @@
29
        $this->assertEquals(1, $results['buckets'][1]['doc_count']);
30
    }
31
32
    protected function _getIndexForTest(): Index
33
    {
34
        $index = $this->_createIndex();
35
        $index->setMapping(new Mapping([
36
            'location' => ['type' => 'geo_point'],
37
        ]));
38
39
        $index->addDocuments([
40
            new Document(1, ['location' => ['lat' => 32.849437, 'lon' => -117.271732]]),
41
            new Document(2, ['location' => ['lat' => 32.798320, 'lon' => -117.246648]]),
42
            new Document(3, ['location' => ['lat' => 37.782439, 'lon' => -122.392560]]),
43
        ]);
44
45
        $index->refresh();
46
47
        return $index;
48
    }
49
}
50

tests/Aggregation/GeoDistanceTest.php 1 location

@@ 51-67 (lines=17) @@
48
        $this->assertSame($expected, array_keys($results['buckets']));
49
    }
50
51
    protected function _getIndexForTest(): Index
52
    {
53
        $index = $this->_createIndex();
54
        $index->setMapping(new Mapping([
55
            'location' => ['type' => 'geo_point'],
56
        ]));
57
58
        $index->addDocuments([
59
            new Document(1, ['location' => ['lat' => 32.849437, 'lon' => -117.271732]]),
60
            new Document(2, ['location' => ['lat' => 32.798320, 'lon' => -117.246648]]),
61
            new Document(3, ['location' => ['lat' => 37.782439, 'lon' => -122.392560]]),
62
        ]);
63
64
        $index->refresh();
65
66
        return $index;
67
    }
68
}
69