Issues (201)

tests/Driver/AbstractSQLiteDriverTest.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\AbstractSQLiteDriver;
10
use Doctrine\DBAL\Platforms\AbstractPlatform;
11
use Doctrine\DBAL\Platforms\SqlitePlatform;
12
use Doctrine\DBAL\Schema\AbstractSchemaManager;
13
use Doctrine\DBAL\Schema\SqliteSchemaManager;
14
15
class AbstractSQLiteDriverTest extends AbstractDriverTest
16
{
17
    protected function createDriver() : Driver
18
    {
19
        return $this->getMockForAbstractClass(AbstractSQLiteDriver::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getMockFor...actSQLiteDriver::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 SqlitePlatform();
25
    }
26
27
    protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
28
    {
29
        return new SqliteSchemaManager($connection);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    protected static function getExceptionConversionData() : array
36
    {
37
        return [
38
            self::EXCEPTION_CONNECTION => [
39
                [0, null, 'unable to open database file'],
40
            ],
41
            self::EXCEPTION_INVALID_FIELD_NAME => [
42
                [0, null, 'has no column named'],
43
            ],
44
            self::EXCEPTION_NON_UNIQUE_FIELD_NAME => [
45
                [0, null, 'ambiguous column name'],
46
            ],
47
            self::EXCEPTION_NOT_NULL_CONSTRAINT_VIOLATION => [
48
                [0, null, 'may not be NULL'],
49
            ],
50
            self::EXCEPTION_READ_ONLY => [
51
                [0, null, 'attempt to write a readonly database'],
52
            ],
53
            self::EXCEPTION_SYNTAX_ERROR => [
54
                [0, null, 'syntax error'],
55
            ],
56
            self::EXCEPTION_TABLE_EXISTS => [
57
                [0, null, 'already exists'],
58
            ],
59
            self::EXCEPTION_TABLE_NOT_FOUND => [
60
                [0, null, 'no such table:'],
61
            ],
62
            self::EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION => [
63
                [0, null, 'must be unique'],
64
                [0, null, 'is not unique'],
65
                [0, null, 'are not unique'],
66
            ],
67
            self::EXCEPTION_FOREIGN_KEY_CONSTRAINT_VIOLATION => [
68
                [0, null, 'FOREIGN KEY constraint failed'],
69
            ],
70
            self::EXCEPTION_LOCK_WAIT_TIMEOUT => [
71
                [0, null, 'database is locked'],
72
            ],
73
        ];
74
    }
75
}
76