@@ -167,6 +167,41 @@ public function test_rules_printing_export_works()
167
167
$ this ->assertCount (1 , $ fields ->where ('key ' , 'field_6 ' )->where ('description ' , 'in:"1","2","3" ' ));
168
168
}
169
169
170
+ public function test_rules_printing_get_export_works ()
171
+ {
172
+ config ([
173
+ 'api-postman.enable_formdata ' => true ,
174
+ 'api-postman.print_rules ' => true ,
175
+ 'api-postman.rules_to_human_readable ' => false ,
176
+ ]);
177
+
178
+ $ this ->artisan ('export:postman ' )->assertExitCode (0 );
179
+
180
+ $ this ->assertTrue (true );
181
+
182
+ $ collection = collect (json_decode (Storage::get ('postman/ ' .config ('api-postman.filename ' )), true )['item ' ]);
183
+
184
+ $ targetRequest = $ collection
185
+ ->where ('name ' , 'example/getWithFormRequest ' )
186
+ ->first ();
187
+
188
+ $ fields = collect ($ targetRequest ['request ' ]['url ' ]['query ' ]);
189
+ $ this ->assertCount (1 , $ fields ->where ('key ' , 'field_1 ' )->where ('description ' , 'required ' ));
190
+ $ this ->assertCount (1 , $ fields ->where ('key ' , 'field_2 ' )->where ('description ' , 'required, integer ' ));
191
+ $ this ->assertCount (1 , $ fields ->where ('key ' , 'field_5 ' )->where ('description ' , 'required, integer, max:30, min:1 ' ));
192
+ $ this ->assertCount (1 , $ fields ->where ('key ' , 'field_6 ' )->where ('description ' , 'in:"1","2","3" ' ));
193
+
194
+ // Check for the required structure of the get request query
195
+ foreach ($ fields as $ field ) {
196
+ $ this ->assertEqualsCanonicalizing ([
197
+ 'key ' => $ field ['key ' ],
198
+ 'value ' => null ,
199
+ 'disabled ' => false ,
200
+ 'description ' => $ field ['description ' ]
201
+ ], $ field );
202
+ }
203
+ }
204
+
170
205
public function test_rules_printing_export_to_human_readable_works ()
171
206
{
172
207
config ([
0 commit comments