Skip to content

Commit 7e316c8

Browse files
committed
Add test for chunk's early return fix
1 parent af66f94 commit 7e316c8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/DynamoDbNonCompositeModelTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,22 @@ public function testChunkScanCondition()
687687
$this->assertEquals(3, $total_results);
688688
}
689689

690+
public function testChunkEarlyReturn()
691+
{
692+
$this->seed(['name' => ['S' => 'Foo']]);
693+
$this->seed(['name' => ['S' => 'Foo2']]);
694+
$this->seed(['name' => ['S' => 'Foo3']]);
695+
696+
$iteration = 1;
697+
698+
$this->testModel->chunk(2, function () use (&$iteration) {
699+
$iteration++;
700+
return false;
701+
});
702+
703+
$this->assertEquals(2, $iteration);
704+
}
705+
690706
public function testStaticMethods()
691707
{
692708
$item = $this->seed(['name' => ['S' => 'Foo'], 'description' => ['S' => 'Bar']]);

0 commit comments

Comments
 (0)