lundi 22 février 2021

Laravel Expected status code 200 but received 500

That's the code for my unit test, the default one:

<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class ExampleTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }
}

I'm running the laravel project on: php artisan serv

When I manually access the / the project works fine! however on the test I'm getting this error:

  Expected status code 200 but received 500.
  Failed asserting that 200 is identical to 500.

How can I fix that please?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire