Skip to content

Commit 8dcf41e

Browse files
authored
Quoter test (for increase test support) (#155)
* Remove connection from Quoter * Add tests for Quoter
1 parent 3c66aea commit 8dcf41e

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

tests/QuoterTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yiisoft\Db\Pgsql\Tests;
6+
7+
use Yiisoft\Db\TestSupport\TestQuoterTrait;
8+
9+
/**
10+
* @group pgsql
11+
*/
12+
final class QuoterTest extends TestCase
13+
{
14+
use TestQuoterTrait;
15+
16+
/**
17+
* @return string[][]
18+
*/
19+
public function simpleTableNamesProvider(): array
20+
{
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+
];
56+
}
57+
}

0 commit comments

Comments
 (0)