|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Tests\Common; |
|
6
|
|
|
|
|
7
|
|
|
use Yiisoft\Db\Tests\AbstractQuoterTest; |
|
8
|
|
|
use Yiisoft\Db\Tests\Support\TestTrait; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @group mssql |
|
12
|
|
|
* @group mysql |
|
13
|
|
|
* @group pgsql |
|
14
|
|
|
* @group oracle |
|
15
|
|
|
* @group sqlite |
|
16
|
|
|
*/ |
|
17
|
|
|
abstract class CommonQuoterTest extends AbstractQuoterTest |
|
18
|
|
|
{ |
|
19
|
|
|
use TestTrait; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::columnName() |
|
23
|
|
|
*/ |
|
24
|
|
|
public function testQuoteColumnNameWithDbGetQuoter(string $columnName, string $expected): void |
|
25
|
|
|
{ |
|
26
|
|
|
$db = $this->getConnection(); |
|
27
|
|
|
|
|
28
|
|
|
$quoter = $db->getQuoter(); |
|
29
|
|
|
$quoted = $quoter->quoteColumnName($columnName); |
|
30
|
|
|
|
|
31
|
|
|
$this->assertSame($expected, $quoted); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::simpleColumnName() |
|
36
|
|
|
*/ |
|
37
|
|
|
public function testQuoteSimpleColumnNameWithDbGetQuoter(string $columnName, string $expected): void |
|
38
|
|
|
{ |
|
39
|
|
|
$db = $this->getConnection(); |
|
40
|
|
|
|
|
41
|
|
|
$quoter = $db->getQuoter(); |
|
42
|
|
|
$quoted = $quoter->quoteSimpleColumnName($columnName); |
|
43
|
|
|
|
|
44
|
|
|
$this->assertSame($expected, $quoted); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::simpleTableName() |
|
49
|
|
|
*/ |
|
50
|
|
|
public function testQuoteSimpleTableNameWithDbGetQuoter(string $tableName, string $expected): void |
|
51
|
|
|
{ |
|
52
|
|
|
$db = $this->getConnection(); |
|
53
|
|
|
|
|
54
|
|
|
$quoter = $db->getQuoter(); |
|
55
|
|
|
$quoted = $quoter->quoteSimpleTableName($tableName); |
|
56
|
|
|
|
|
57
|
|
|
$this->assertSame($expected, $quoted); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::unquoteSimpleColumnName |
|
62
|
|
|
*/ |
|
63
|
|
|
public function testUnquoteSimpleColumnNameWithDbGetQuoter(string $tableName, string $expected): void |
|
64
|
|
|
{ |
|
65
|
|
|
$db = $this->getConnection(); |
|
66
|
|
|
|
|
67
|
|
|
$quoter = $db->getQuoter(); |
|
68
|
|
|
$quoted = $quoter->unquoteSimpleColumnName($tableName); |
|
69
|
|
|
|
|
70
|
|
|
$this->assertSame($expected, $quoted); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::unquoteSimpleTableName() |
|
75
|
|
|
*/ |
|
76
|
|
|
public function testUnquoteSimpleTableNameWithDbGetQuoter(string $tableName, string $expected): void |
|
77
|
|
|
{ |
|
78
|
|
|
$db = $this->getConnection(); |
|
79
|
|
|
|
|
80
|
|
|
$quoter = $db->getQuoter(); |
|
81
|
|
|
$unquoted = $quoter->unquoteSimpleTableName($tableName); |
|
82
|
|
|
|
|
83
|
|
|
$this->assertSame($expected, $unquoted); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|