|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Tests\Schema; |
|
6
|
|
|
|
|
7
|
|
|
use Yiisoft\Db\Tests\AbstractQuoterTest; |
|
8
|
|
|
use Yiisoft\Db\Tests\Support\TestTrait; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @group db |
|
12
|
|
|
* |
|
13
|
|
|
* @psalm-suppress PropertyNotSetInConstructor |
|
14
|
|
|
*/ |
|
15
|
|
|
final class QuoterTest extends AbstractQuoterTest |
|
16
|
|
|
{ |
|
17
|
|
|
use TestTrait; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::tableNameParts() |
|
21
|
|
|
*/ |
|
22
|
|
|
public function testGetTableNameParts(string $tableName, array $expected): void |
|
23
|
|
|
{ |
|
24
|
|
|
$this->assertSame($expected, $this->getQuoter()->getTableNameParts($tableName)); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::columnName() |
|
29
|
|
|
*/ |
|
30
|
|
|
public function testQuoteColumnName(string $columnName, string $expected): void |
|
31
|
|
|
{ |
|
32
|
|
|
$this->assertSame($expected, $this->getQuoter()->quoteColumnName($columnName)); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::simpleColumnName() |
|
37
|
|
|
*/ |
|
38
|
|
|
public function testQuoteSimpleColumnName(string $columnName, string $expected): void |
|
39
|
|
|
{ |
|
40
|
|
|
$this->assertSame($expected, $this->getQuoter()->quoteSimpleColumnName($columnName)); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::simpleTableName() |
|
45
|
|
|
*/ |
|
46
|
|
|
public function testQuoteSimpleTableName(string $columnName, string $expected): void |
|
47
|
|
|
{ |
|
48
|
|
|
$this->assertSame($expected, $this->getQuoter()->quoteSimpleTableName($columnName)); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::tableName() |
|
53
|
|
|
*/ |
|
54
|
|
|
public function testQuoteTableName(string $tableName, string $expected): void |
|
55
|
|
|
{ |
|
56
|
|
|
$this->assertSame($expected, $this->getQuoter()->quoteTableName($tableName)); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::unquoteSimpleColumnName() |
|
61
|
|
|
*/ |
|
62
|
|
|
public function testUnquoteSimpleColumnName(string $columnName, string $expected): void |
|
63
|
|
|
{ |
|
64
|
|
|
$this->assertSame($expected, $this->getQuoter()->unquoteSimpleColumnName($columnName)); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::unquoteSimpleTableName() |
|
69
|
|
|
*/ |
|
70
|
|
|
public function testUnquoteSimpleTableName(string $tableName, string $expected): void |
|
71
|
|
|
{ |
|
72
|
|
|
$this->assertSame($expected, $this->getQuoter()->unquoteSimpleTableName($tableName)); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|