Test.Error 预期状态代码 200 但已收到 200.How 修复?
Test.Error Expected status code 200 but received 200.How to fix it?
我为 CompanyController 创建了测试,
public function testCompanyIndex()
{
$user = factory(User::class)->create();
$response = $this->actingAs($user, 'web')->get('company/index');
$response->assertStatus('200');
}
但我有一个错误:
1) Tests\Feature\CompanyTest::testCompanyIndex
Expected status code 200 but received 200.
Failed asserting that false is true.
在 CompanyController 中,我有中间件 auth:web
。CompanyController@index
returns 所有公司。
只需删除这样的引号 $response->assertStatus(200);
有关详细信息,请单击 here
我为 CompanyController 创建了测试,
public function testCompanyIndex()
{
$user = factory(User::class)->create();
$response = $this->actingAs($user, 'web')->get('company/index');
$response->assertStatus('200');
}
但我有一个错误:
1) Tests\Feature\CompanyTest::testCompanyIndex Expected status code 200 but received 200. Failed asserting that false is true.
在 CompanyController 中,我有中间件 auth:web
。CompanyController@index
returns 所有公司。
只需删除这样的引号 $response->assertStatus(200);
有关详细信息,请单击 here