lundi 22 novembre 2021

Expected status code 200 but received 500. Failed asserting that false is true. in Laravel 5.5

I always get the error 500 while it is status 200 in the browse. I have already checked on the other answers but there is no solution.

here is the code in UserTest

<?php

namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithoutMiddleware;

class UserTest extends TestCase
{
/**
 * A basic test example.
 *
 * @return void
 */
    public function testExample()
    {
        $this->assertTrue(true);
        //$this->withoutExceptionHandling();
        $response = $this->get('/');
        $response->assertStatus(200);
    }

}

here is the result of the test

PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

F                                                                   1 / 1 (100%)

Time: 00:02.105, Memory: 22.00 MB

There was 1 failure:

1) Tests\Feature\UserTest::testExample
Expected status code 200 but received 500.
Failed asserting that false is true.

var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:78
/var/www/laravel/tests/Feature/UserTest.php:22

FAILURES!
Tests: 1, Assertions: 2, Failures: 1.

Thank you in advance for your answer, even the few clues



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3HL2QD0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire