[英]ReflectionException Class UserController does not exist Laravel5.4
[英]ReflectionException: Laravel 5.4
我在运行phpunit
时收到此异常。 我正在使用PHPUnit 5.7.23运行最新的Laravel 5.4
ReflectionException: Class config does not exist
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Container/Container.php:729
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Container/Container.php:608
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Container/Container.php:575
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:728
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Container/Container.php:1172
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:57
/home/vagrant/Code/ProcessingHub-App/vendor/myvendor/core/src/app/Providers/CoreServiceProvider.php:50
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:574
/home/vagrant/Code/ProcessingHub-App/tests/CreatesApplication.php:18
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:89
/home/vagrant/Code/ProcessingHub-App/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:66
/home/vagrant/Code/ProcessingHub-App/tests/TestCase.php:27
/home/vagrant/Code/ProcessingHub-App/tests/Unit/PassportTest.php:30
如您所见,异常来自CoreServiceProvider,这是我自己的ServiceProviders之一,您可以在这里看到奇怪的事情
/**
* Register any package services.
*
* @return void
*/
public function register()
{
$this->registerEloquentFactoriesFrom(__DIR__.'/../../database/factories');
$this->mergeConfigFrom(
__DIR__.'/../../config/fields.php', 'fields'
);
}
fields.php的内容:
return [];
如果我推荐$this->mergeConfigFrom()
它就像一个魅力,但奇怪的是我在多个ServiceProviders中做到了,在这些类中这不是问题。
我真的尝试了一切。
composer dump-autoload
php artisan optimize
我的问题是:
annyone知道我该如何解决。
在重新安装了Laravel之后,进入\\ tests目录后,我看到了我盯着看了好几个小时的东西。
在引导应用程序之前,该应用程序试图注册 ServiceProvider 。 很抱歉给您带来麻烦(这不是我的代码)。
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
$app->register(\StepOrange\Core\Providers\CoreServiceProvider::class);
return $app;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.