Code Duplication    Length = 13-15 lines in 4 locations

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

@@ 36-50 (lines=15) @@
33
        }
34
    }
35
36
    public function testCreateDatabase()
37
    {
38
        $db = new HTTP\SocketClient();
39
40
        // Remove maybe existing database
41
        try {
42
            $db->request( 'DELETE', '/' . $this->getTestDatabase() );
43
        } catch ( \Exception $e ) { /* Irrelevant exception */ }
44
45
        $response = $db->request( 'PUT', '/' . $this->getTestDatabase() );
46
47
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
48
49
        $this->assertTrue($response->body['ok']);
50
    }
51
52
    /**
53
     * @depends testCreateDatabase
@@ 255-267 (lines=13) @@
252
    /**
253
     * @depends testCreateDatabase
254
     */
255
    public function testArrayResponse()
256
    {
257
        $db = new HTTP\SocketClient();
258
259
        $db->request( 'PUT', '/' . $this->getTestDatabase() );
260
        $response = $db->request( 'GET', '/_all_dbs' );
261
262
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
263
264
        $this->assertInternalType('array', $response->body);
265
266
        $this->assertContains(\Doctrine\Tests\ODM\CouchDB\TestUtil::getTestDatabase(), $response->body);
267
    }
268
269
    /**
270
     * @depends testCreateDatabase

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

@@ 51-65 (lines=15) @@
48
        }
49
    }
50
51
    public function testCreateDatabase()
52
    {
53
        $db = new HTTP\StreamClient();
54
55
        // Remove maybe existing database
56
        try {
57
            $db->request( 'DELETE', '/' . $this->getTestDatabase() . '' );
58
        } catch ( \Exception $e ) { /* Irrelevant exception */ }
59
60
        $response = $db->request( 'PUT', '/' . $this->getTestDatabase() . '' );
61
62
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
63
64
        $this->assertTrue($response->body['ok']);
65
    }
66
67
    /**
68
     * @depends testCreateDatabase
@@ 269-283 (lines=15) @@
266
    /**
267
     * @depends testCreateDatabase
268
     */
269
    public function testArrayResponse()
270
    {
271
        $db = new HTTP\StreamClient();
272
273
        try {
274
            $db->request( 'PUT', '/' . $this->getTestDatabase() . '' );
275
        } catch ( \Exception $e ) { /* Ignore */ }
276
        $response = $db->request( 'GET', '/_all_dbs' );
277
278
        $this->assertInstanceOf('Doctrine\CouchDB\HTTP\Response', $response);
279
280
        $this->assertInternalType('array', $response->body);
281
282
        $this->assertContains(\Doctrine\Tests\ODM\CouchDB\TestUtil::getTestDatabase(), $response->body);
283
    }
284
285
    /**
286
     * @depends testCreateDatabase