响应状态代码[200]不是重定向状态代码。声明false为真的失败

时间:2018-01-28 09:23:46

标签: unit-testing testing laravel-5 laravel-5.4 laravel-testing

这是我的代码laravel单元测试登录

public function testClientSucceslogin()
{
    $user = factory(User::class)->create([
        'password' => 'secret',
        'status' => User::STATUS_ACTIVE,
        'type' => User::TYPE_CLIENT
    ]);
    $clientProfile = ClientProfile::where('client_id', $user->client_id)->first();
    $client_alias = Client::where('id', $user->client_id)->first();

    $this->get(route('login', [$user->email, $user->password]))
        ->assertStatus(200)
        ->assertRedirect('dashboard', [$client_alias->alias, $clientProfile->id])
        ->assertTrue(true);


}

我收到了这个错误

Response status code [200] is not a redirect status code. Failed asserting that false is true.

我将状态代码更改为302但我收到此错误

enter code heExpected status code 302 but received 200.

声明false为真的失败。

我如何解决这个问题?

0 个答案:

没有答案