Laravel - RuntimeException - 无法扫描“app/tests/TestCase.php”中的类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24347503/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:40:59  来源:igfitidea点击:

Laravel - RuntimeException - Could not scan for classes inside "app/tests/TestCase.php"

laravellaravel-4

提问by Dan

I've been using Laravel to display a custom blog for a month or so now and it's been working perfectly.

我已经使用 Laravel 来显示自定义博客一个月左右了,它一直在完美运行。

I just took a look at my site and it's saying:

我刚刚看了看我的网站,上面写着:

/vendor/symfony/security/Symfony/Component/Security/Core/Util/SecureRandom.php): failed to open stream: No such file or directory

Having looked in the folders the location of the above file is actually:

查看文件夹后,上述文件的位置实际上是:

/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandom.php): failed to open stream: No such file or directory

but I haven't changed this?

但我没有改变这个?

If I try and run composer updateI get this error:

如果我尝试运行,composer update我会收到此错误:

root@server [/laravel]# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files

  [RuntimeException]
  Could not scan for classes inside "app/tests/TestCase.php" which does not appear to be a file nor a folder

Any ideas what's causing this or how I should go about fixing / debugging it?

任何想法是什么导致了这个或我应该如何修复/调试它?

回答by Laurence

Do you have a app/tests/TestCase.phpfile on your production server?

app/tests/TestCase.php你的生产服务器上有文件吗?

If not - you should remove it from composer.json(or put the file back there)

如果没有 - 您应该将其从composer.json(或将文件放回那里)

回答by shashik493

I have same problem facing in Laravel 5.1, But is resolved now. Solution is : only test directory and files are in root directory structure. Other wise we removed in composer.json.

我在 Laravel 5.1 中遇到了同样的问题,但现在已解决。解决方案是:只有测试目录和文件在根目录结构中。否则我们在 composer.json 中删除了。

Note: We should be maintain for the core Directory structure and files on frameworks, due to feature migration and enhance the project and testing purpose.

注意:由于功能迁移和增强项目和测试目的,我们应该维护框架上的核心目录结构和文件。