Code Duplication    Length = 20-20 lines in 2 locations

tests/Aggregation/CardinalityTest.php 1 location

@@ 77-96 (lines=20) @@
74
        ];
75
    }
76
77
    protected function _getIndexForTest(): Index
78
    {
79
        $index = $this->_createIndex();
80
81
        $mapping = new Mapping([
82
            'color' => ['type' => 'keyword'],
83
        ]);
84
        $index->setMapping($mapping);
85
86
        $index->addDocuments([
87
            new Document(1, ['color' => 'blue']),
88
            new Document(2, ['color' => 'blue']),
89
            new Document(3, ['color' => 'red']),
90
            new Document(4, ['color' => 'green']),
91
        ]);
92
93
        $index->refresh();
94
95
        return $index;
96
    }
97
}
98

tests/Aggregation/TermsTest.php 1 location

@@ 120-139 (lines=20) @@
117
        $this->assertSame('blue', $results['buckets'][2]['key']);
118
    }
119
120
    private function getIndex(): Index
121
    {
122
        $index = $this->_createIndex();
123
124
        $mapping = new Mapping([
125
            'color' => ['type' => 'keyword'],
126
        ]);
127
        $index->setMapping($mapping);
128
129
        $index->addDocuments([
130
            new Document(1, ['color' => 'blue']),
131
            new Document(2, ['color' => 'blue']),
132
            new Document(3, ['color' => 'red']),
133
            new Document(4, ['color' => 'green']),
134
        ]);
135
136
        $index->refresh();
137
138
        return $index;
139
    }
140
}
141