Passed
Pull Request — master (#395)
by Wilmer
04:09 queued 01:23
created

QuoterTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 72
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testQuoteSimpleTableName() 0 5 1
A testUnquoteSimpleTableName() 0 5 1
A testQuoteSimpleColumnName() 0 5 1
A testUnquoteSimpleColumnName() 0 5 1
A testQuoteTableName() 0 5 1
A testQuoteColumnName() 0 5 1
A testGetTableNameParts() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Schema;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Tests\Support\TestTrait;
9
10
/**
11
 * @group db
12
 *
13
 * @psalm-suppress PropertyNotSetInConstructor
14
 */
15
final class QuoterTest extends TestCase
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
        $db = $this->getConnection();
25
26
        $this->assertSame($expected, $db->getQuoter()->getTableNameParts($tableName));
27
    }
28
29
    /**
30
     * @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::columnName()
31
     */
32
    public function testQuoteColumnName(string $columnName, string $expected): void
33
    {
34
        $db = $this->getConnection();
35
36
        $this->assertSame($expected, $db->getQuoter()->quoteColumnName($columnName));
37
    }
38
39
    /**
40
     * @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::simpleColumnName()
41
     */
42
    public function testQuoteSimpleColumnName(string $columnName, string $expected): void
43
    {
44
        $db = $this->getConnection();
45
46
        $this->assertSame($expected, $db->getQuoter()->quoteSimpleColumnName($columnName));
47
    }
48
49
    /**
50
     * @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::simpleTableName()
51
     */
52
    public function testQuoteSimpleTableName(string $columnName, string $expected): void
53
    {
54
        $db = $this->getConnection();
55
56
        $this->assertSame($expected, $db->getQuoter()->quoteSimpleTableName($columnName));
57
    }
58
59
    /**
60
     * @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::tableName()
61
     */
62
    public function testQuoteTableName(string $tableName, string $expected): void
63
    {
64
        $db = $this->getConnection();
65
66
        $this->assertSame($expected, $db->getQuoter()->quoteTableName($tableName));
67
    }
68
69
    /**
70
     * @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::unquoteSimpleColumnName()
71
     */
72
    public function testUnquoteSimpleColumnName(string $columnName, string $expected): void
73
    {
74
        $db = $this->getConnection();
75
76
        $this->assertSame($expected, $db->getQuoter()->unquoteSimpleColumnName($columnName));
77
    }
78
79
    /**
80
     * @dataProvider \Yiisoft\Db\Tests\Provider\QuoterProvider::unquoteSimpleTableName()
81
     */
82
    public function testUnquoteSimpleTableName(string $tableName, string $expected): void
83
    {
84
        $db = $this->getConnection();
85
86
        $this->assertSame($expected, $db->getQuoter()->unquoteSimpleTableName($tableName));
87
    }
88
}
89