2 months ago

The current user is not authenticated PHPUnit

Posted 2 months ago by BrownieCoffee

Hello guys, are are you?

Can you help me to fix this error please?

I try since 1 week to fix that but nothing yet.

I did test to know if a user can login

    public function user_can_login_with_valid_fields(){

        $user = factory(User::class, 1)->create([
            'password' => bcrypt('i-love-laravel'),
       $response = $this->post(route('connexion'), [
            'email' => $user->email,
            'password' => 'i-love-laravel',



...but I have this error:

Time: 5.51 seconds, Memory: 24.00 MB

There was 1 failure:

1) Tests\Feature\LoginTest::user_can_login_with_valid_fields
The current user is not authenticated.
Failed asserting that null is not null.


I searched on the internet without find a solution. I hope you help me for that !

Thank you by advance and see you soon.

ps: sorry for my english.

Please sign in or create an account to participate in this conversation.