Skip to content

Commit

Permalink
Add test for chunk's early return fix
Browse files Browse the repository at this point in the history
  • Loading branch information
baopham committed Nov 16, 2018
1 parent af66f94 commit 7e316c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/DynamoDbNonCompositeModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,22 @@ public function testChunkScanCondition()
$this->assertEquals(3, $total_results);
}

public function testChunkEarlyReturn()
{
$this->seed(['name' => ['S' => 'Foo']]);
$this->seed(['name' => ['S' => 'Foo2']]);
$this->seed(['name' => ['S' => 'Foo3']]);

$iteration = 1;

$this->testModel->chunk(2, function () use (&$iteration) {
$iteration++;
return false;
});

$this->assertEquals(2, $iteration);
}

public function testStaticMethods()
{
$item = $this->seed(['name' => ['S' => 'Foo'], 'description' => ['S' => 'Bar']]);
Expand Down

0 comments on commit 7e316c8

Please sign in to comment.