Passed
Pull Request — master (#380)
by Wilmer
02:50
created

SchemaTest::testGetSchemaPrimaryKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Schema;
6
7
use Yiisoft\Db\Exception\NotSupportedException;
8
use Yiisoft\Db\Tests\AbstractSchemaTest;
9
use Yiisoft\Db\Tests\Support\TestTrait;
10
11
/**
12
 * @group db
13
 *
14
 * @psalm-suppress PropertyNotSetInConstructor
15
 */
16
final class SchemaTest extends AbstractSchemaTest
17
{
18
    use TestTrait;
19
20
    public function testGetSchemaChecks(): void
21
    {
22
        $db = $this->getConnection();
23
24
        $schema = $db->getSchema();
25
26
        $this->expectException(NotSupportedException::class);
27
        $this->expectExceptionMessage(
28
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all table names.'
29
        );
30
31
        $schema->getSchemaChecks();
32
    }
33
34
    public function testGetSchemaDefaultValues(): void
35
    {
36
        $db = $this->getConnection();
37
38
        $schema = $db->getSchema();
39
40
        $this->expectException(NotSupportedException::class);
41
        $this->expectExceptionMessage(
42
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all table names.'
43
        );
44
45
        $schema->getSchemaDefaultValues();
46
    }
47
48
    public function testGetSchemaForeignKeys(): void
49
    {
50
        $db = $this->getConnection();
51
52
        $schema = $db->getSchema();
53
54
        $this->expectException(NotSupportedException::class);
55
        $this->expectExceptionMessage(
56
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all table names.'
57
        );
58
59
        $schema->getSchemaForeignKeys();
60
    }
61
62
    public function testGetSchemaIndexes(): void
63
    {
64
        $db = $this->getConnection();
65
66
        $schema = $db->getSchema();
67
68
        $this->expectException(NotSupportedException::class);
69
        $this->expectExceptionMessage(
70
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all table names.'
71
        );
72
73
        $schema->getSchemaIndexes();
74
    }
75
76
    public function testGetSchemaNames(): void
77
    {
78
        $db = $this->getConnection();
79
80
        $schema = $db->getSchema();
81
82
        $this->expectException(NotSupportedException::class);
83
        $this->expectExceptionMessage(
84
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all schema names.'
85
        );
86
87
        $schema->getSchemaNames();
88
    }
89
90
    public function testGetSchemaPrimaryKeys(): void
91
    {
92
        $db = $this->getConnection();
93
94
        $schema = $db->getSchema();
95
96
        $this->expectException(NotSupportedException::class);
97
        $this->expectExceptionMessage(
98
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all table names.'
99
        );
100
101
        $schema->getSchemaPrimaryKeys();
102
    }
103
104
    public function testGetSchemaUniques(): void
105
    {
106
        $db = $this->getConnection();
107
108
        $schema = $db->getSchema();
109
110
        $this->expectException(NotSupportedException::class);
111
        $this->expectExceptionMessage(
112
            'Yiisoft\Db\Tests\Support\Stubs\Schema does not support fetching all table names.'
113
        );
114
115
        $schema->getSchemaUniques();
116
    }
117
118
    public function testGetTableChecks(): void
119
    {
120
        $db = $this->getConnection();
121
122
        $schema = $db->getSchema();
123
124
        $this->expectException(NotSupportedException::class);
125
        $this->expectExceptionMessage(
126
            'Yiisoft\Db\Tests\Support\Stubs\Schema::loadTableChecks() is not supported by core-db.'
127
        );
128
129
        $schema->getTableChecks('customer');
130
    }
131
132
    public function testGetTableDefaultValues(): void
133
    {
134
        $db = $this->getConnection();
135
136
        $schema = $db->getSchema();
137
138
        $this->expectException(NotSupportedException::class);
139
        $this->expectExceptionMessage(
140
            'Yiisoft\Db\Tests\Support\Stubs\Schema::loadTableDefaultValues() is not supported by core-db.'
141
        );
142
143
        $schema->getTableDefaultValues('customer');
144
    }
145
146
    public function testGetTableForeignKeys(): void
147
    {
148
        $db = $this->getConnection();
149
150
        $schema = $db->getSchema();
151
152
        $this->expectException(NotSupportedException::class);
153
        $this->expectExceptionMessage(
154
            'Yiisoft\Db\Tests\Support\Stubs\Schema::loadTableForeignKeys() is not supported by core-db.'
155
        );
156
157
        $schema->getTableForeignKeys('customer');
158
    }
159
}
160