Code Duplication    Length = 21-21 lines in 2 locations

tests/Aggregation/CardinalityTest.php 1 location

@@ 93-113 (lines=21) @@
90
        ];
91
    }
92
93
    protected function _getIndexForTest(): Index
94
    {
95
        $index = $this->_createIndex();
96
97
        $mapping = new Mapping([
98
            'color' => ['type' => 'keyword'],
99
        ]);
100
        $index->setMapping($mapping);
101
102
        $index->addDocuments([
103
            new Document(1, ['color' => 'blue']),
104
            new Document(2, ['color' => 'blue']),
105
            new Document(3, ['color' => 'red']),
106
            new Document(4, ['color' => 'green']),
107
            new Document(5, ['anything' => 'anything']),
108
        ]);
109
110
        $index->refresh();
111
112
        return $index;
113
    }
114
}
115

tests/Aggregation/TermsTest.php 1 location

@@ 134-154 (lines=21) @@
131
        $this->assertSame('blue', $results['buckets'][2]['key']);
132
    }
133
134
    private function getIndex(): Index
135
    {
136
        $index = $this->_createIndex();
137
138
        $mapping = new Mapping([
139
            'color' => ['type' => 'keyword'],
140
        ]);
141
        $index->setMapping($mapping);
142
143
        $index->addDocuments([
144
            new Document(1, ['color' => 'blue']),
145
            new Document(2, ['color' => 'blue']),
146
            new Document(3, ['color' => 'red']),
147
            new Document(4, ['color' => 'green']),
148
            new Document(5, ['anything' => 'anything']),
149
        ]);
150
151
        $index->refresh();
152
153
        return $index;
154
    }
155
}
156