| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function testBatchWithIndexBy(): void |
||
| 20 | { |
||
| 21 | $this->checkFixture($this->db(), 'customer'); |
||
| 22 | |||
| 23 | $customerQuery = new ActiveQuery(Customer::class); |
||
| 24 | |||
| 25 | $query = $customerQuery->orderBy('id')->limit(3)->indexBy('id'); |
||
| 26 | |||
| 27 | $customers = $this->getAllRowsFromBatch($query->batch(2)); |
||
| 28 | |||
| 29 | $this->assertCount(3, $customers); |
||
| 30 | $this->assertEquals('user1', $customers[0]->getName()); |
||
| 31 | $this->assertEquals('user2', $customers[1]->getName()); |
||
| 32 | $this->assertEquals('user3', $customers[2]->getName()); |
||
| 33 | } |
||
| 35 |