Issues (201)

tests/Driver/AbstractSQLAnywhereDriverTest.php (1 issue)

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\AbstractSQLAnywhereDriver;
10
use Doctrine\DBAL\Platforms\AbstractPlatform;
11
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
12
use Doctrine\DBAL\Schema\AbstractSchemaManager;
13
use Doctrine\DBAL\Schema\SQLAnywhereSchemaManager;
14
15
class AbstractSQLAnywhereDriverTest extends AbstractDriverTest
16
{
17
    protected function createDriver() : Driver
18
    {
19
        return $this->getMockForAbstractClass(AbstractSQLAnywhereDriver::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getMockFor...LAnywhereDriver::class) returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return Doctrine\DBAL\Driver.
Loading history...
20
    }
21
22
    protected function createPlatform() : AbstractPlatform
23
    {
24
        return new SQLAnywhere16Platform();
25
    }
26
27
    protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
28
    {
29
        return new SQLAnywhereSchemaManager($connection);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    protected function getDatabasePlatformsForVersions() : array
36
    {
37
        return [
38
            ['16', SQLAnywhere16Platform::class],
39
            ['16.0', SQLAnywhere16Platform::class],
40
            ['16.0.0', SQLAnywhere16Platform::class],
41
            ['16.0.0.0', SQLAnywhere16Platform::class],
42
            ['16.1.2.3', SQLAnywhere16Platform::class],
43
            ['16.9.9.9', SQLAnywhere16Platform::class],
44
            ['17', SQLAnywhere16Platform::class],
45
        ];
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     */
51
    protected static function getExceptionConversionData() : array
52
    {
53
        return [
54
            self::EXCEPTION_CONNECTION => [
55
                [-100],
56
                [-103],
57
                [-832],
58
            ],
59
            self::EXCEPTION_FOREIGN_KEY_CONSTRAINT_VIOLATION => [
60
                [-198],
61
            ],
62
            self::EXCEPTION_INVALID_FIELD_NAME => [
63
                [-143],
64
            ],
65
            self::EXCEPTION_NON_UNIQUE_FIELD_NAME => [
66
                [-144],
67
            ],
68
            self::EXCEPTION_NOT_NULL_CONSTRAINT_VIOLATION => [
69
                [-184],
70
                [-195],
71
            ],
72
            self::EXCEPTION_SYNTAX_ERROR => [
73
                [-131],
74
            ],
75
            self::EXCEPTION_TABLE_EXISTS => [
76
                [-110],
77
            ],
78
            self::EXCEPTION_TABLE_NOT_FOUND => [
79
                [-141],
80
                [-1041],
81
            ],
82
            self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => [
83
                [-193],
84
                [-196],
85
            ],
86
            self::EXCEPTION_DEADLOCK => [
87
                [-306],
88
                [-307],
89
                [-684],
90
            ],
91
            self::EXCEPTION_LOCK_WAIT_TIMEOUT => [
92
                [-210],
93
                [-1175],
94
                [-1281],
95
            ],
96
        ];
97
    }
98
}
99