| Total Complexity | 2 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class QueryTest extends AbstractQueryTest |
||
| 12 | { |
||
| 13 | protected ?string $driverName = 'mysql'; |
||
| 14 | |||
| 15 | public function testQueryIndexHint(): void |
||
| 16 | { |
||
| 17 | $query = (new Query($this->getConnection()))->from([new Expression('{{%customer}} USE INDEX (primary)')]); |
||
| 18 | |||
| 19 | $row = $query->one(); |
||
| 20 | |||
| 21 | $this->assertArrayHasKey('id', $row); |
||
| 22 | $this->assertArrayHasKey('name', $row); |
||
| 23 | $this->assertArrayHasKey('email', $row); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function testLimitOffsetWithExpression(): void |
||
| 27 | { |
||
| 28 | $query = (new Query($this->getConnection()))->from('customer')->select('id')->orderBy('id'); |
||
| 29 | |||
| 30 | // In MySQL limit and offset arguments must both be non negative integer constant |
||
| 31 | $query->limit(new Expression('2'))->offset(new Expression('1')); |
||
| 32 | |||
| 33 | $result = $query->column(); |
||
| 34 | |||
| 35 | $this->assertCount(2, $result); |
||
| 36 | $this->assertContains("2", $result); |
||
| 37 | $this->assertContains("3", $result); |
||
| 38 | $this->assertNotContains("1", $result); |
||
| 39 | } |
||
| 41 |