mardi 23 février 2016

Laravel PHPUnit testing, weird behavior with seePageIs()

Trying to get the hang of testing. I have a fairly simple test just to make sure the user is kicked to login when they go to the root page:

public function index_without_auth_should_redirect_to_login()
    {
        $response = $this->get('/');
        $response->seeStatusCode(302);
        $response->seePageIs('/login');
    }

This works up to the last line, where it seems like instead of checking the current path, the test itself is trying to redirect as I get this error running phpunit:

A request to [http://localhost/login] failed. Received status code [302].

Is there a different way I need to check the url?

Aucun commentaire:

Enregistrer un commentaire