1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Doctrine\DBAL\Tests\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\Schema\AbstractSchemaManager; |
||
14 | use Doctrine\DBAL\Schema\PostgreSqlSchemaManager; |
||
15 | |||
16 | class AbstractPostgreSQLDriverTest extends AbstractDriverTest |
||
17 | { |
||
18 | protected function createDriver() : Driver |
||
19 | { |
||
20 | return $this->getMockForAbstractClass(AbstractPostgreSQLDriver::class); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
21 | } |
||
22 | |||
23 | protected function createPlatform() : AbstractPlatform |
||
24 | { |
||
25 | return new PostgreSQL94Platform(); |
||
26 | } |
||
27 | |||
28 | protected function createSchemaManager(Connection $connection) : AbstractSchemaManager |
||
29 | { |
||
30 | return new PostgreSqlSchemaManager($connection); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritDoc} |
||
35 | */ |
||
36 | protected function getDatabasePlatformsForVersions() : array |
||
37 | { |
||
38 | return [ |
||
39 | ['9.4', PostgreSQL94Platform::class], |
||
40 | ['9.4.0', PostgreSQL94Platform::class], |
||
41 | ['9.4.1', PostgreSQL94Platform::class], |
||
42 | ['10', PostgreSQL100Platform::class], |
||
43 | ]; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritDoc} |
||
48 | */ |
||
49 | protected static function getExceptionConversionData() : array |
||
50 | { |
||
51 | return [ |
||
52 | self::EXCEPTION_CONNECTION => [ |
||
53 | [7, null, 'SQLSTATE[08006]'], |
||
54 | ], |
||
55 | self::EXCEPTION_FOREIGN_KEY_CONSTRAINT_VIOLATION => [ |
||
56 | [0, '23503'], |
||
57 | ], |
||
58 | self::EXCEPTION_INVALID_FIELD_NAME => [ |
||
59 | [0, '42703'], |
||
60 | ], |
||
61 | self::EXCEPTION_NON_UNIQUE_FIELD_NAME => [ |
||
62 | [0, '42702'], |
||
63 | ], |
||
64 | self::EXCEPTION_NOT_NULL_CONSTRAINT_VIOLATION => [ |
||
65 | [0, '23502'], |
||
66 | ], |
||
67 | self::EXCEPTION_SYNTAX_ERROR => [ |
||
68 | [0, '42601'], |
||
69 | ], |
||
70 | self::EXCEPTION_TABLE_EXISTS => [ |
||
71 | [0, '42P07'], |
||
72 | ], |
||
73 | self::EXCEPTION_TABLE_NOT_FOUND => [ |
||
74 | [0, '42P01'], |
||
75 | ], |
||
76 | self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => [ |
||
77 | [0, '23505'], |
||
78 | ], |
||
79 | self::EXCEPTION_DEADLOCK => [ |
||
80 | [0, '40001'], |
||
81 | [0, '40P01'], |
||
82 | ], |
||
83 | ]; |
||
84 | } |
||
85 | } |
||
86 |