Code Duplication    Length = 19-19 lines in 4 locations

tests/Doctrine/Tests/ODM/CouchDB/HTTP/SocketClientTest.php 2 locations

@@ 272-290 (lines=19) @@
269
    /**
270
     * @depends testCreateDatabase
271
     */
272
    public function testCloseConnection()
273
    {
274
        $db = new HTTP\SocketClient();
275
        $db->setOption( 'keep-alive', false );
276
277
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/123', '{"_id":"123","data":"Foo"}' );
278
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/456', '{"_id":"456","data":"Foo"}' );
279
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/789', '{"_id":"789","data":"Foo"}' );
280
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/012', '{"_id":"012","data":"Foo"}' );
281
282
        $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/_all_docs' );
283
284
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
285
286
        $this->assertSame(
287
            4,
288
            $response->body['total_rows']
289
        );
290
    }
291
292
    /**
293
     * @depends testCreateDatabase
@@ 295-313 (lines=19) @@
292
    /**
293
     * @depends testCreateDatabase
294
     */
295
    public function testKeepAliveConnection()
296
    {
297
        $db = new HTTP\SocketClient();
298
        $db->setOption( 'keep-alive', true );
299
300
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/123', '{"_id":"123","data":"Foo"}' );
301
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/456', '{"_id":"456","data":"Foo"}' );
302
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/789', '{"_id":"789","data":"Foo"}' );
303
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/012', '{"_id":"012","data":"Foo"}' );
304
305
        $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/_all_docs' );
306
307
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
308
309
        $this->assertSame(
310
            4,
311
            $response->body['total_rows']
312
        );
313
    }
314
315
    /**
316
     * @depends testCreateDatabase

tests/Doctrine/Tests/ODM/CouchDB/HTTP/StreamClientTest.php 2 locations

@@ 288-306 (lines=19) @@
285
    /**
286
     * @depends testCreateDatabase
287
     */
288
    public function testCloseConnection()
289
    {
290
        $db = new HTTP\StreamClient();
291
        $db->setOption( 'keep-alive', false );
292
293
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/123', '{"_id":"123","data":"Foo"}' );
294
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/456', '{"_id":"456","data":"Foo"}' );
295
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/789', '{"_id":"789","data":"Foo"}' );
296
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/012', '{"_id":"012","data":"Foo"}' );
297
298
        $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/_all_docs' );
299
300
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
301
302
        $this->assertSame(
303
            4,
304
            $response->body['total_rows']
305
        );
306
    }
307
308
    /**
309
     * @depends testCreateDatabase
@@ 311-329 (lines=19) @@
308
    /**
309
     * @depends testCreateDatabase
310
     */
311
    public function testKeepAliveConnection()
312
    {
313
        $db = new HTTP\StreamClient();
314
        $db->setOption( 'keep-alive', true );
315
316
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/123', '{"_id":"123","data":"Foo"}' );
317
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/456', '{"_id":"456","data":"Foo"}' );
318
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/789', '{"_id":"789","data":"Foo"}' );
319
        $db->request( 'PUT', '/' . $this->getTestDatabase() . '/012', '{"_id":"012","data":"Foo"}' );
320
321
        $response = $db->request( 'GET', '/' . $this->getTestDatabase() . '/_all_docs' );
322
323
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
324
325
        $this->assertSame(
326
            4,
327
            $response->body['total_rows']
328
        );
329
    }
330
331
    /**
332
     * @depends testCreateDatabase