Commit 9dd27175 authored by David Furnes's avatar David Furnes

Add test for chunkById.

parent b8ce7a5f
...@@ -534,4 +534,18 @@ class ModelTest extends TestCase ...@@ -534,4 +534,18 @@ class ModelTest extends TestCase
$user->birthday = new DateTime('19 august 1989'); $user->birthday = new DateTime('19 august 1989');
$this->assertEmpty($user->getDirty()); $this->assertEmpty($user->getDirty());
} }
public function testChunkById()
{
User::create(['name' => 'fork', 'tags' => ['sharp', 'pointy']]);
User::create(['name' => 'spork', 'tags' => ['sharp', 'pointy', 'round', 'bowl']]);
User::create(['name' => 'spoon', 'tags' => ['round', 'bowl']]);
$count = 0;
User::chunkById(2, function ($items) use (&$count) {
$count += count($items);
});
$this->assertEquals(3, $count);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment