@@ -46,6 +46,7 @@ public function output_writes_nothing_for_empty_tree()
46
46
47
47
/**
48
48
* @test
49
+ *
49
50
* @dataProvider controllerTreeDataProvider
50
51
*/
51
52
public function output_writes_migration_for_controller_tree ($ definition , $ path , $ controller )
@@ -240,4 +241,31 @@ public function controllerTreeDataProvider()
240
241
['drafts/invokable-controller-shorthand.yaml ' , 'app/Http/Controllers/ReportController.php ' , 'controllers/invokable-controller-shorthand.php ' ],
241
242
];
242
243
}
244
+
245
+ public function testOutputGeneratesControllersWithTypehints (): void
246
+ {
247
+ $ definition = 'drafts/controller-returns-view-typehint.yaml ' ;
248
+ $ path = 'app/Http/Controllers/UserController.php ' ;
249
+ $ controller = 'controllers/controller-returns-view-typehint.php ' ;
250
+
251
+ $ this ->app ['config ' ]->set ('blueprint.use_return_types ' , true );
252
+
253
+ $ this ->filesystem ->expects ('stub ' )
254
+ ->with ('controller.class.stub ' )
255
+ ->andReturn ($ this ->stub ('controller.class.stub ' ));
256
+ $ this ->filesystem ->expects ('stub ' )
257
+ ->with ('controller.method.stub ' )
258
+ ->andReturn ($ this ->stub ('controller.method.stub ' ));
259
+
260
+ $ this ->filesystem ->expects ('exists ' )
261
+ ->with (dirname ($ path ))
262
+ ->andReturnTrue ();
263
+ $ this ->filesystem ->expects ('put ' )
264
+ ->with ($ path , $ this ->fixture ($ controller ));
265
+
266
+ $ tokens = $ this ->blueprint ->parse ($ this ->fixture ($ definition ));
267
+ $ tree = $ this ->blueprint ->analyze ($ tokens );
268
+
269
+ self ::assertSame (['created ' => [$ path ]], $ this ->subject ->output ($ tree ));
270
+ }
243
271
}
0 commit comments