Code Duplication    Length = 18-18 lines in 2 locations

tests/Transport/HttpTest.php 2 locations

@@ 185-202 (lines=18) @@
182
    /**
183
     * @group functional
184
     */
185
    public function testRequestSuccessWithHttpCompressionEnabled(): void
186
    {
187
        $client = $this->_getClient(['transport' => ['type' => 'Http', 'compression' => true, 'curl' => [\CURLINFO_HEADER_OUT => true]]]);
188
189
        $index = $client->getIndex('elastica_request_with_body_and_http_compression_enabled');
190
191
        $createIndexResponse = $index->create([], [
192
            'recreate' => true,
193
        ]);
194
195
        $createIndexResponseTransferInfo = $createIndexResponse->getTransferInfo();
196
        if (\method_exists($this, 'assertMatchesRegularExpression')) {
197
            $this->assertMatchesRegularExpression('/Accept-Encoding:\ (gzip|deflate)/', $createIndexResponseTransferInfo['request_header']);
198
        } else {
199
            $this->assertRegExp('/Accept-Encoding:\ (gzip|deflate)/', $createIndexResponseTransferInfo['request_header']);
200
        }
201
        $this->assertArrayHasKey('acknowledged', $createIndexResponse->getData());
202
    }
203
204
    /**
205
     * @group functional
@@ 207-224 (lines=18) @@
204
    /**
205
     * @group functional
206
     */
207
    public function testRequestSuccessWithHttpCompressionDisabled(): void
208
    {
209
        $client = $this->_getClient(['transport' => ['type' => 'Http', 'compression' => false, 'curl' => [\CURLINFO_HEADER_OUT => true]]]);
210
211
        $index = $client->getIndex('elastica_request_with_body_and_http_compression_disabled');
212
213
        $createIndexResponse = $index->create([], [
214
            'recreate' => true,
215
        ]);
216
217
        $createIndexResponseTransferInfo = $createIndexResponse->getTransferInfo();
218
        if (\method_exists($this, 'assertMatchesRegularExpression')) {
219
            $this->assertMatchesRegularExpression('/Accept-Encoding:\ (gzip|deflate)/', $createIndexResponseTransferInfo['request_header']);
220
        } else {
221
            $this->assertRegExp('/Accept-Encoding:\ (gzip|deflate)/', $createIndexResponseTransferInfo['request_header']);
222
        }
223
        $this->assertArrayHasKey('acknowledged', $createIndexResponse->getData());
224
    }
225
226
    protected function checkProxy($url): void
227
    {