File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,20 @@ public function test_scopes_are_applied_to_query()
4747 'value ' => 'bar ' ,
4848 ], $ query ->filters ['and ' ][0 ]);
4949 }
50+
51+ public function test_scopes_are_applied_to_pagination_request ()
52+ {
53+ Container::addConnection (new Connection ());
54+
55+ $ query = (new ModelScopeTestStub ())->newQuery ();
56+ $ this ->assertEmpty ($ query ->paginate ());
57+
58+ $ this ->assertEquals ([
59+ 'field ' => 'foo ' ,
60+ 'operator ' => '= ' ,
61+ 'value ' => 'bar ' ,
62+ ], $ query ->filters ['and ' ][0 ]);
63+ }
5064}
5165
5266class ModelScopeTestStub extends Model
@@ -59,6 +73,11 @@ protected static function boot()
5973 });
6074 static ::addGlobalScope (new ScopeTestStub ());
6175 }
76+
77+ public function newQueryBuilder (Connection $ connection )
78+ {
79+ return new ModelBuilderTestStub ($ connection );
80+ }
6281}
6382
6483class ScopeTestStub implements Scope
@@ -68,3 +87,11 @@ public function apply(Builder $query, Model $model)
6887 $ query ->whereRaw ('foo ' , '= ' , 'bar ' );
6988 }
7089}
90+
91+ class ModelBuilderTestStub extends Builder
92+ {
93+ protected function runPaginate ($ filter , $ perPage , $ isCritical )
94+ {
95+ return [];
96+ }
97+ }
You can’t perform that action at this time.
0 commit comments