Code Duplication    Length = 28-28 lines in 2 locations

tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php 1 location

@@ 11-38 (lines=28) @@
8
9
class AbstractMySQLDriverTest extends AbstractDriverTest
10
{
11
    public function testReturnsDatabaseName()
12
    {
13
        parent::testReturnsDatabaseName();
14
15
        $database = 'bloo';
16
        $params   = array(
17
            'user'     => 'foo',
18
            'password' => 'bar',
19
        );
20
21
        $statement = $this->createMock('Doctrine\Tests\Mocks\DriverResultStatementMock');
22
23
        $statement->expects($this->once())
24
            ->method('fetchColumn')
25
            ->will($this->returnValue($database));
26
27
        $connection = $this->getConnectionMock();
28
29
        $connection->expects($this->once())
30
            ->method('getParams')
31
            ->will($this->returnValue($params));
32
33
        $connection->expects($this->once())
34
            ->method('query')
35
            ->will($this->returnValue($statement));
36
37
        $this->assertSame($database, $this->driver->getDatabase($connection));
38
    }
39
40
    protected function createDriver()
41
    {

tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php 1 location

@@ 11-38 (lines=28) @@
8
9
class AbstractPostgreSQLDriverTest extends AbstractDriverTest
10
{
11
    public function testReturnsDatabaseName()
12
    {
13
        parent::testReturnsDatabaseName();
14
15
        $database = 'bloo';
16
        $params   = array(
17
            'user'     => 'foo',
18
            'password' => 'bar',
19
        );
20
21
        $statement = $this->createMock('Doctrine\Tests\Mocks\DriverResultStatementMock');
22
23
        $statement->expects($this->once())
24
            ->method('fetchColumn')
25
            ->will($this->returnValue($database));
26
27
        $connection = $this->getConnectionMock();
28
29
        $connection->expects($this->once())
30
            ->method('getParams')
31
            ->will($this->returnValue($params));
32
33
        $connection->expects($this->once())
34
            ->method('query')
35
            ->will($this->returnValue($statement));
36
37
        $this->assertSame($database, $this->driver->getDatabase($connection));
38
    }
39
40
    protected function createDriver()
41
    {