Passed
Pull Request — master (#418)
by Wilmer
06:28 queued 03:44
created

AbstractQuoterProvider::tableNameParts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Provider;
6
7
abstract class AbstractQuoterProvider
8
{
9
    /**
10
     * @return string[][]
11
     */
12
    public function columnNames(): array
13
    {
14
        return [
15
            ['*', '*'],
16
        ];
17
    }
18
19
    /**
20
     * @return string[][]
21
     */
22
    public function ensureColumnName(): array
23
    {
24
        return [
25
            ['*', '*'],
26
            ['`*`', '`*`'],
27
            ['[[*]]', '[[*]]'],
28
            ['{{*}}', '{{*}}'],
29
            ['table.column', 'column'],
30
            ['`table`.`column`', '`column`'],
31
            ['[[table]].[[column]]', 'column'],
32
            ['{{table}}.{{column}}', '{{column}}'],
33
        ];
34
    }
35
36
    /**
37
     * @return string[][]
38
     */
39
    public function ensureNameQuoted(): array
40
    {
41
        return [
42
            ['name', '{{name}}'],
43
            ['`name`', '{{name}}'],
44
            ['[[name]]', '{{name}}'],
45
            ['{{name}}', '{{name}}'],
46
            ['table.name', '{{table.name}}'],
47
            ['`table`.`name`', '{{table.name}}'],
48
            ['[[table]].[[name]]', '{{table.name}}'],
49
            ['{{table}}.{{name}}', '{{table}}.{{name}}'],
50
        ];
51
    }
52
53
    /**
54
     * @return string[][]
55
     */
56
    public function simpleColumnNames(): array
57
    {
58
        return [
59
            ['*', '*', '*'],
60
        ];
61
    }
62
63
    /**
64
     * @return string[][]
65
     */
66
    public function simpleTableNames(): array
67
    {
68
        return [
69
            ['test', 'test'],
70
        ];
71
    }
72
73
    /**
74
     * @return string[][]
75
     */
76
    public function tableNameParts(): array
77
    {
78
        return [
79
            ['animal', 'animal',],
80
            ['dbo.animal', 'animal', 'dbo'],
81
            ['[dbo].[animal]', 'animal', 'dbo'],
82
            ['[other].[animal2]', 'animal2', 'other'],
83
            ['other.[animal2]', 'animal2', 'other'],
84
            ['other.animal2', 'animal2', 'other'],
85
        ];
86
    }
87
}
88