Completed
Push — develop ( dcb0ff...425513 )
by Sergei
23s queued 13s
created

testReturnsDatabaseName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 27
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A AbstractPostgreSQLDriverTest::getDatabasePlatformsForVersions() 0 10 1
A AbstractPostgreSQLDriverTest::createPlatform() 0 3 1
A AbstractPostgreSQLDriverTest::createSchemaManager() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Driver;
6
7
use Doctrine\DBAL\Connection;
8
use Doctrine\DBAL\Driver;
9
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
10
use Doctrine\DBAL\Platforms\AbstractPlatform;
11
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
12
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
13
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
14
use Doctrine\DBAL\Schema\AbstractSchemaManager;
15
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
16
17
class AbstractPostgreSQLDriverTest extends AbstractDriverTest
18
{
19
    protected function createDriver() : Driver
20
    {
21
        return $this->getMockForAbstractClass(AbstractPostgreSQLDriver::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getMockFor...ostgreSQLDriver::class) returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return Doctrine\DBAL\Driver.
Loading history...
22
    }
23
24
    protected function createPlatform() : AbstractPlatform
25
    {
26
        return new PostgreSqlPlatform();
27
    }
28
29
    protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
30
    {
31
        return new PostgreSqlSchemaManager($connection);
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     */
37
    protected function getDatabasePlatformsForVersions() : array
38
    {
39
        return [
40
            ['9.3', PostgreSqlPlatform::class],
41
            ['9.3.0', PostgreSqlPlatform::class],
42
            ['9.3.6', PostgreSqlPlatform::class],
43
            ['9.4', PostgreSQL94Platform::class],
44
            ['9.4.0', PostgreSQL94Platform::class],
45
            ['9.4.1', PostgreSQL94Platform::class],
46
            ['10', PostgreSQL100Platform::class],
47
        ];
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53
    protected static function getExceptionConversionData() : array
54
    {
55
        return [
56
            self::EXCEPTION_CONNECTION => [
57
                [7, null, 'SQLSTATE[08006]'],
58
            ],
59
            self::EXCEPTION_FOREIGN_KEY_CONSTRAINT_VIOLATION => [
60
                [0, '23503'],
61
            ],
62
            self::EXCEPTION_INVALID_FIELD_NAME => [
63
                [0, '42703'],
64
            ],
65
            self::EXCEPTION_NON_UNIQUE_FIELD_NAME => [
66
                [0, '42702'],
67
            ],
68
            self::EXCEPTION_NOT_NULL_CONSTRAINT_VIOLATION => [
69
                [0, '23502'],
70
            ],
71
            self::EXCEPTION_SYNTAX_ERROR => [
72
                [0, '42601'],
73
            ],
74
            self::EXCEPTION_TABLE_EXISTS => [
75
                [0, '42P07'],
76
            ],
77
            self::EXCEPTION_TABLE_NOT_FOUND => [
78
                [0, '42P01'],
79
            ],
80
            self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => [
81
                [0, '23505'],
82
            ],
83
            self::EXCEPTION_DEADLOCK => [
84
                [0, '40001'],
85
                [0, '40P01'],
86
            ],
87
        ];
88
    }
89
}
90