Unexpected AuthenticationException

Posted 6 days ago by Danieloplata

Hi guys,

I recently upgraded a basic CRUD project from 5.7 to 5.8 and worked through fixing a few tests that now failed. I've sorted out all the important ones, but I have an annoying one bugging me.

/** @test */
public function guests_cannot_manage_projects()
{
    $this->withoutExceptionHandling();

    $project = factory('App\Project')->create();

    $this->get('/projects')
        ->assertRedirect('login');
        
    ...
        
}

This test returns:

Illuminate\Auth\AuthenticationException : Unauthenticated.

Manually testing the route gives me the redirect to login as expected.

I figured I could change my assertions here to just check for the exception but that didn't work either, and I would prefer to either check for the redirect or both, rather than just the exception.

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

Reply to

Use Markdown with GitHub-flavored code blocks.