|
1 | 1 | <?php |
2 | 2 |
|
3 | | -declare(strict_types = 1); |
| 3 | +declare(strict_types=1); |
4 | 4 |
|
5 | 5 | namespace Odan\Database\Test; |
6 | 6 |
|
@@ -87,7 +87,8 @@ public function testQuoteName() |
87 | 87 | $this->assertSame('`dbname`.`tablename`', $quoter->quoteName('dbname.tablename')); |
88 | 88 | $this->assertSame('`dbname`.`tablename`.`field`', $quoter->quoteName('dbname.tablename.field')); |
89 | 89 | // Alias.field AS thing |
90 | | - $this->assertSame('`dbname`.`tablename`.`field` AS `thing`', $quoter->quoteName('dbname.tablename.field AS thing')); |
| 90 | + $this->assertSame('`dbname`.`tablename`.`field` AS `thing`', |
| 91 | + $quoter->quoteName('dbname.tablename.field AS thing')); |
91 | 92 |
|
92 | 93 | $this->assertSame('`.`', $quoter->quoteName('.')); |
93 | 94 | $this->assertSame('`?`', $quoter->quoteName('?')); |
@@ -130,4 +131,22 @@ public function testQuoteNames() |
130 | 131 | $row = ['a', 'a.b', 'a.b.c', new RawExp('a.z')]; |
131 | 132 | $this->assertSame(['`a`', '`a`.`b`', '`a`.`b`.`c`', 'a.z'], $quoter->quoteNames($row)); |
132 | 133 | } |
| 134 | + |
| 135 | + /** |
| 136 | + * Test. |
| 137 | + * |
| 138 | + * @return void |
| 139 | + */ |
| 140 | + public function testQuoteByFields() |
| 141 | + { |
| 142 | + $quoter = $this->getConnection()->getQuoter(); |
| 143 | + $this->assertSame([], $quoter->quoteByFields([])); |
| 144 | + |
| 145 | + $row = ['a', 'a.b', 'a.b.c', new RawExp('a.z')]; |
| 146 | + $this->assertSame(['`a`', '`a`.`b`', '`a`.`b`.`c`', 'a.z'], $quoter->quoteByFields($row)); |
| 147 | + |
| 148 | + $row = ['ÿ', "\0", "'", '"']; |
| 149 | + $this->assertSame(['`ÿ`', '``', "`'`", '`"`'], $quoter->quoteByFields($row)); |
| 150 | + } |
| 151 | + |
133 | 152 | } |
0 commit comments