【发布时间】:2021-05-16 01:59:12
【问题描述】:
我有一个使用 Vagrant Homestead 在本地网络上运行的 Laravel 应用程序。 我尝试实现 HTTP 测试,我首先创建了一个像文档这样的基本测试:
/**
* A basic feature test example.
*
* @return void
*/
public function testExample()
{
$response = $this->get('/');
$response->assertStatus(200);
}
但是当我运行测试时,我收到了错误: 预期的状态代码为 200,但收到了 500。
但是我可以毫无问题地访问我的网站。
我做错了什么?
谢谢
【问题讨论】:
-
使用
$this->withoutExceptionHandling();查看实际异常。 -
@leoden 你能分享文件
Test Case的所有内容吗? -
@apokryfos 谢谢你,我现在有我的例外:
ErrorException : Route [category.show] not defined. (View: homepage.blade.php)我可以调试它。问题是我用语言环境重命名了我的路线,例如: fr.category.show 和 en.category.show
标签: laravel http testing phpunit