jeudi 6 mai 2021

Laravel PHPunit redirect to localhost

I am trying to use actingAs (Laravel 5.8) to login for my test but it doesn't appear to do much as it keeps redirecting me to localhost. No clue where it get's this from as I am not redirecy to localhost anywhere, it should at least redirect to my app url?

 public function testCategoriesIndex()
{
    $response = $this->actingAs($this->superAdminUser)
                        ->withSession(['companyId' => $this->testCompany->id])
                        ->get(url("/{$this->routePrefix}/categories{$this->urlParameters}"));       

    dd($response->content());
    
    $response->assertStatus(200);
}

output

<!DOCTYPE html>\n
<html>\n
    <head>\n
        <meta charset="UTF-8" />\n
        <meta http-equiv="refresh" content="0;url='http://localhost/login'" />\n
\n
        <title>Redirecting to http://localhost/login</title>\n
    </head>\n
    <body>\n
        Redirecting to <a href="http://localhost/login">http://localhost/login</a>.\n
    </body>\n
</html>

The docs don't mention anything about any of this stuff either, might as well empty.... https://laravel.com/docs/5.8/testing



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire