Skip to content

Commit 08cba81

Browse files
Remove src\TestSupport\TestQuoterTrait from yiisoft\db. (#185)
* Remove src\TestSupport\TestQuoterTrait from yiisoft\db.
1 parent f875d4f commit 08cba81

2 files changed

Lines changed: 33 additions & 40 deletions

File tree

tests/Provider/QuoterProvider.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yiisoft\Db\Pgsql\Tests\Provider;
6+
7+
use Yiisoft\Db\Tests\Provider\AbstractQuoterProvider;
8+
9+
final class QuoterProvider extends AbstractQuoterProvider
10+
{
11+
public function tableNameParts(): array
12+
{
13+
return [
14+
['', ''],
15+
['[]', '[]'],
16+
['animal', 'animal'],
17+
['dbo.animal', 'animal', 'dbo'],
18+
['[dbo].[animal]', '[animal]', '[dbo]'],
19+
['[other].[animal2]', '[animal2]', '[other]'],
20+
['other.[animal2]', '[animal2]', 'other'],
21+
['other.animal2', 'animal2', 'other'],
22+
];
23+
}
24+
}

tests/QuoterTest.php

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,23 @@
44

55
namespace Yiisoft\Db\Pgsql\Tests;
66

7-
use Yiisoft\Db\TestSupport\TestQuoterTrait;
7+
use Yiisoft\Db\Pgsql\Tests\Support\TestTrait;
8+
use Yiisoft\Db\Tests\AbstractQuoterTest;
89

910
/**
1011
* @group pgsql
12+
*
13+
* @psalm-suppress PropertyNotSetInConstructor
1114
*/
12-
final class QuoterTest extends TestCase
15+
final class QuoterTest extends AbstractQuoterTest
1316
{
14-
use TestQuoterTrait;
17+
use TestTrait;
1518

1619
/**
17-
* @return string[][]
20+
* @dataProvider \Yiisoft\Db\Pgsql\Tests\Provider\QuoterProvider::tableNameParts()
1821
*/
19-
public function simpleTableNamesProvider(): array
22+
public function testGetTableNameParts(string $tableName, string ...$expected): void
2023
{
21-
return [
22-
['test', 'test', ],
23-
['te`st', 'te`st', ],
24-
['te\'st', 'te\'st', ],
25-
['current-table-name', 'current-table-name', ],
26-
['"current-table-name"', 'current-table-name', ],
27-
];
28-
}
29-
30-
/**
31-
* @return string[][]
32-
*/
33-
public function simpleColumnNamesProvider(): array
34-
{
35-
return [
36-
['test', '"test"', 'test'],
37-
['"test"', '"test"', 'test'],
38-
['*', '*', '*'],
39-
];
40-
}
41-
42-
/**
43-
* @return string[][]
44-
*/
45-
public function columnNamesProvider(): array
46-
{
47-
return [
48-
['*', '*'],
49-
['table.*', '"table".*'],
50-
['"table".*', '"table".*'],
51-
['table.column', '"table"."column"'],
52-
['"table".column', '"table"."column"'],
53-
['table."column"', '"table"."column"'],
54-
['"table"."column"', '"table"."column"'],
55-
];
24+
parent::testGetTableNameParts($tableName, ...$expected);
5625
}
5726
}

0 commit comments

Comments
 (0)