File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
tests/Console/MetaCommand Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -251,12 +251,16 @@ protected function getExpectedArguments()
251251 */
252252 protected function loadTemplate ($ name )
253253 {
254- if (!isset ($ this ->templates [$ name ])) {
254+ if (!isset ($ this ->templateCache [$ name ])) {
255255 $ file = __DIR__ . '/../../php-templates/ ' . basename ($ name ) . '.php ' ;
256- $ this ->templates [$ name ] = $ this ->files ->requireOnce ($ file );
256+ $ value = $ this ->files ->requireOnce ($ file ) ?: [];
257+ if (!$ value instanceof Collection) {
258+ $ value = collect ($ value );
259+ }
260+ $ this ->templateCache [$ name ] = $ value ;
257261 }
258262
259- return $ this ->templates [$ name ];
263+ return $ this ->templateCache [$ name ];
260264 }
261265
262266 /**
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function testCommand(): void
2727
2828 $ mockFileSystem
2929 ->shouldReceive ('getRequire ' )
30- ->andReturnUsing (function ($ __path , $ __data ) {
30+ ->andReturnUsing (function ($ __path , $ __data = [] ) {
3131 return (static function () use ($ __path , $ __data ) {
3232 extract ($ __data , EXTR_SKIP );
3333
@@ -60,7 +60,7 @@ public function testUnregisterAutoloader(): void
6060
6161 $ mockFileSystem
6262 ->shouldReceive ('getRequire ' )
63- ->andReturnUsing (function ($ __path , $ __data ) {
63+ ->andReturnUsing (function ($ __path , $ __data = [] ) {
6464 return (static function () use ($ __path , $ __data ) {
6565 extract ($ __data , EXTR_SKIP );
6666
You can’t perform that action at this time.
0 commit comments