|
| 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