【发布时间】:2021-07-28 18:26:19
【问题描述】:
我正在尝试使用actingAs (Laravel 5.8) 登录我的测试,但它似乎没有做太多,因为它不断将我重定向到本地主机。不知道它是从哪里得到的,因为我没有重定向到任何地方的本地主机,它至少应该重定向到我的应用程序 url?
public function testCategoriesIndex()
{
$response = $this->actingAs($this->superAdminUser)
->withSession(['companyId' => $this->testCompany->id])
->get(url("/{$this->routePrefix}/categories{$this->urlParameters}"));
dd($response->content());
$response->assertStatus(200);
}
输出
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta charset="UTF-8" />\n
<meta http-equiv="refresh" content="0;url='http://localhost/login'" />\n
\n
<title>Redirecting to http://localhost/login</title>\n
</head>\n
<body>\n
Redirecting to <a href="http://localhost/login">http://localhost/login</a>.\n
</body>\n
</html>
文档也没有提到任何关于这些东西的任何内容,还不如空着...... https://laravel.com/docs/5.8/testing
【问题讨论】: