mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Fix test
This commit is contained in:
@@ -251,12 +251,16 @@ class MetaCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function loadTemplate($name)
|
protected function loadTemplate($name)
|
||||||
{
|
{
|
||||||
if (!isset($this->templates[$name])) {
|
if (!isset($this->templateCache[$name])) {
|
||||||
$file = __DIR__ . '/../../php-templates/' . basename($name) . '.php';
|
$file = __DIR__ . '/../../php-templates/' . basename($name) . '.php';
|
||||||
$this->templates[$name] = $this->files->requireOnce($file);
|
$value = $this->files->requireOnce($file) ?: [];
|
||||||
|
if (!$value instanceof Collection) {
|
||||||
|
$value = collect($value);
|
||||||
|
}
|
||||||
|
$this->templateCache[$name] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->templates[$name];
|
return $this->templateCache[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class MetaCommandTest extends TestCase
|
|||||||
|
|
||||||
$mockFileSystem
|
$mockFileSystem
|
||||||
->shouldReceive('getRequire')
|
->shouldReceive('getRequire')
|
||||||
->andReturnUsing(function ($__path, $__data) {
|
->andReturnUsing(function ($__path, $__data = []) {
|
||||||
return (static function () use ($__path, $__data) {
|
return (static function () use ($__path, $__data) {
|
||||||
extract($__data, EXTR_SKIP);
|
extract($__data, EXTR_SKIP);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class MetaCommandTest extends TestCase
|
|||||||
|
|
||||||
$mockFileSystem
|
$mockFileSystem
|
||||||
->shouldReceive('getRequire')
|
->shouldReceive('getRequire')
|
||||||
->andReturnUsing(function ($__path, $__data) {
|
->andReturnUsing(function ($__path, $__data = []) {
|
||||||
return (static function () use ($__path, $__data) {
|
return (static function () use ($__path, $__data) {
|
||||||
extract($__data, EXTR_SKIP);
|
extract($__data, EXTR_SKIP);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user