File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,23 @@ public function it_fetches_all_columns_if_no_field_was_requested_but_allowed_fie
4747 $ this ->assertEquals ($ expected , $ query );
4848 }
4949
50+ /** @test */
51+ public function it_replaces_selected_columns_on_the_query ()
52+ {
53+ $ query = $ this
54+ ->createQueryFromFieldRequest (['test_models ' => 'name,id ' ])
55+ ->select (['id ' , 'is_visible ' ])
56+ ->allowedFields (['name ' , 'id ' ])
57+ ->toSql ();
58+
59+ $ expected = TestModel::query ()
60+ ->select ("{$ this ->modelTableName }.name " , "{$ this ->modelTableName }.id " )
61+ ->toSql ();
62+
63+ $ this ->assertEquals ($ expected , $ query );
64+ $ this ->assertStringNotContainsString ('is_visible ' , $ expected );
65+ }
66+
5067 /** @test */
5168 public function it_can_fetch_specific_columns ()
5269 {
You can’t perform that action at this time.
0 commit comments