Code Duplication    Length = 14-17 lines in 3 locations

tests/Aggregation/ValueCountTest.php 1 location

@@ 29-44 (lines=16) @@
26
        $this->assertEquals(5, $results['value']);
27
    }
28
29
    protected function _getIndexForTest(): Index
30
    {
31
        $index = $this->_createIndex();
32
33
        $index->addDocuments([
34
            new Document(1, ['price' => 5]),
35
            new Document(2, ['price' => 8]),
36
            new Document(3, ['price' => 1]),
37
            new Document(4, ['price' => 3]),
38
            new Document(5, ['price' => 3]),
39
        ]);
40
41
        $index->refresh();
42
43
        return $index;
44
    }
45
}
46

tests/Suggest/PhraseTest.php 1 location

@@ 71-84 (lines=14) @@
68
    /**
69
     * @return Index
70
     */
71
    protected function _getIndexForTest()
72
    {
73
        $index = $this->_createIndex();
74
        $index->addDocuments([
75
            new Document(1, ['text' => 'Github is pretty cool']),
76
            new Document(2, ['text' => 'Elasticsearch is bonsai cool']),
77
            new Document(3, ['text' => 'This is a test phrase']),
78
            new Document(4, ['text' => 'Another sentence for testing']),
79
            new Document(5, ['text' => 'Some more words here']),
80
        ]);
81
        $index->refresh();
82
83
        return $index;
84
    }
85
}
86

tests/Aggregation/DateRangeTest.php 1 location

@@ 121-137 (lines=17) @@
118
        }
119
    }
120
121
    protected function _getIndexForTest(): Index
122
    {
123
        $index = $this->_createIndex();
124
        $index->setMapping(new Mapping([
125
            'created' => ['type' => 'date', 'format' => 'epoch_millis'],
126
        ]));
127
128
        $index->addDocuments([
129
            new Document(1, ['created' => 1390962135000]),
130
            new Document(2, ['created' => 1390965735000]),
131
            new Document(3, ['created' => 1390954935000]),
132
        ]);
133
134
        $index->refresh();
135
136
        return $index;
137
    }
138
}
139