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

testReturnsDatabaseName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 16
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A AbstractSQLiteDriverTest::createSchemaManager() 0 3 1
A AbstractSQLiteDriverTest::createPlatform() 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\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_LOCK_WAIT_TIMEOUT => [
68
                [0, null, 'database is locked'],
69
            ],
70
        ];
71
    }
72
}
73