Skip to content

Commit 57eadde

Browse files
committed
Add issue tests
1 parent ff659c8 commit 57eadde

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Integration/CollectionDataTableTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ public function it_returns_all_records_when_no_parameters_is_passed()
2525
]);
2626
}
2727

28+
/** @test */
29+
public function it_returns_zero_filtered_records_on_empty_collection()
30+
{
31+
$crawler = $this->call('GET', '/collection/empty');
32+
$crawler->assertExactJson([
33+
"data" => [],
34+
"draw" => 0,
35+
"input" => [],
36+
'recordsTotal' => 0,
37+
'recordsFiltered' => 0,
38+
]);
39+
}
40+
2841
/** @test */
2942
public function it_can_perform_global_search()
3043
{
@@ -242,5 +255,9 @@ protected function setUp(): void
242255
$this->app['router']->get('/collection/users', function (DataTables $datatables) {
243256
return $datatables->collection(User::all())->toJson();
244257
});
258+
259+
$this->app['router']->get('/collection/empty', function (DataTables $datatables) {
260+
return $datatables->collection([])->toJson();
261+
});
245262
}
246263
}

0 commit comments

Comments
 (0)