dimanche 28 janvier 2018

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

this is my code laravel unit testing for login

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);


}

and I got this error

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

and i changed status code to 302 but i got this error

enter code heExpected status code 302 but received 200.

Failed asserting that false is true.

How I can fix this issue?

Aucun commentaire:

Enregistrer un commentaire