ChristophAust's avatar

404 on simple test example?

Hi there, I am trying to get the example of tests running on my 5.1 installation:

<<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExampleTest extends TestCase
{
    /**
     * A basic functional test example.
     *
     * @return void
     */
    protected $baseUrl = 'https://localhost/abschlussprojekt/public/';
    
    public function testBasicExample()
    {
        $this->visit('/')
             ->see('Testeintrag');
    }
}

But I always get :

  1. ExampleTest::testBasicExample A request to [URL] failed. Received status code [404].

I know the url is right, because copying it from the command line to the browser works. Any ideas on this one?

0 likes
6 replies
ChristophAust's avatar

Nope, I still have a problem. Calling the correct url via

phpunit

results in

A request to [https://localhost/public] failed. Received status code [404].

If I open the url copied from the command line everything works great.

ChristophAust's avatar

I modified the exception handler to give me json exceptions and it seems to get the correct exception from laravel, not a 404 from apache:

1) ArchitekturTest::testSeheTesteintrag
{"success":false,"error":"https:\/\/localhost\/abschlussprojekt\/public\/\/home","code":404}
ChristophAust's avatar
ChristophAust
OP
Best Answer
Level 5

Goddamn it... The modification of the exception handler was incorrect and it gave back constantly a 404. This is really embarassing :D Case closed.

Please or to participate in this conversation.