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); |
|
|
|
|
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
|
|
|
|