File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 77it ('can get data with empty filters ' , function () {
88
99 $ users = User::factory ()->count (5 )->create ();
10-
1110 $ query = User::query ();
1211
1312 $ requestParameters = [
2928 ->toBe (5 );
3029
3130
31+ });
32+
33+ it ('can get data using model instance instead of query builder ' , function () {
34+
35+ $ users = User::factory ()->count (5 )->create ();
36+
37+ $ userModel = new User ();
38+
39+ $ requestParameters = [
40+ 'start ' => 0 ,
41+ 'size ' => 10 ,
42+ 'filters ' => [],
43+ 'sorting ' => []
44+ ];
45+
46+ $ data = (new Datatable ())->run (
47+ $ userModel ,
48+ $ requestParameters
49+ );
50+
51+ expect ($ data ['data ' ])
52+ ->toEqual ($ users ->toArray ());
53+
54+ expect ($ data ['meta ' ]['totalRowCount ' ])
55+ ->toBe (5 );
56+
57+
3258});
3359
3460it ('can get correct data with providing start and size arguments ' , function () {
You can’t perform that action at this time.
0 commit comments