Laravel5.4からLaravel5.5にアップデートした後、PHPUnitを実行するとエラーが発生し困っております。
以下、エラー内容です。
$ vendor/bin/phpunit tests/Unit/FooTest PHPUnit 6.3.0 by Sebastian Bergmann and contributors. E. 2 / 2 (100%) Time: 715 ms, Memory: 10.00MB There was 1 error: 1) Tests\Unit\FooTest::BarMethod ReflectionException: Class path.public does not exist /path/to/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:752 /path/to/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:631 /path/to/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:586 /path/to/project/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:638 /path/to/project/app/Services/HogeService.php:140 /path/to/project/tests/TestCase.php:40 /path/to/project/tests/Unit/fooTest.php:30 ERRORS! Tests: 2, Assertions: 1, Errors: 1. Generating code coverage report in HTML format ... done
エラーを辿っていくと、どうやらヘルパー関数 public_path()
実行時のエラーっぽいことが分かりました。(app()->make('path.public')
の箇所)
vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
if (! function_exists('public_path')) { /** * Get the path to the public folder. * * @param string $path * @return string */ function public_path($path = '') { die("1"); // <-ここでは止まる return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path); } }
vendor/laravel/framework/src/Illuminate/Foundation/Application.php
/** * Bind all of the application paths in the container. * * @return void */ protected function bindPathsInContainer() { die("2"); // ここでは止まらない $this->instance('path', $this->path()); $this->instance('path.base', $this->basePath()); $this->instance('path.lang', $this->langPath()); $this->instance('path.config', $this->configPath()); $this->instance('path.public', $this->publicPath()); $this->instance('path.storage', $this->storagePath()); $this->instance('path.database', $this->databasePath()); $this->instance('path.resources', $this->resourcePath()); $this->instance('path.bootstrap', $this->bootstrapPath()); }
ここまでは分かったのですが、これからどうすれば良いのか分かりません。
原因や確認ポイントなどありましたら教えていただけないでしょうか?
回答1件
あなたの回答
tips
プレビュー