ryrobbo's avatar

Simple test returns 404 [v5.4]

I am doing the simplest of tests but it fails as the response is a 404 page.

My test is this:

class ViewLoginPageTest extends TestCase
{
    /** @test */
    public function user_can_view_login_page()
    {
        $response = $this->get('/login');

        $response->assertStatus(200);
    }
}

I have debugged the request to prove my app URL is set:

GET /app/login HTTP/1.1
Accept:          text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Host:            app.test.vm
User-Agent:      Symfony/3.X

To prove my virtual machine can connect to my website, I can do a wget to http://app.test.vm/app/login and successfully download my login page.

0 likes
1 reply
ryrobbo's avatar

For anyone that stumbles upon this page, the issue was due to the fact the Laravel app was accessible via a sub-folder.

Moving the app to the root fixed it.

Please or to participate in this conversation.