Skip to content

Commit e3772a7

Browse files
committed
Add test for chunkById.
1 parent 1af8e29 commit e3772a7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/ModelTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,4 +534,18 @@ public function testGetDirtyDates()
534534
$user->birthday = new DateTime('19 august 1989');
535535
$this->assertEmpty($user->getDirty());
536536
}
537+
538+
public function testChunkById()
539+
{
540+
User::create(['name' => 'fork', 'tags' => ['sharp', 'pointy']]);
541+
User::create(['name' => 'spork', 'tags' => ['sharp', 'pointy', 'round', 'bowl']]);
542+
User::create(['name' => 'spoon', 'tags' => ['round', 'bowl']]);
543+
544+
$count = 0;
545+
User::chunkById(2, function ($items) use (&$count) {
546+
$count += count($items);
547+
});
548+
549+
$this->assertEquals(3, $count);
550+
}
537551
}

0 commit comments

Comments
 (0)