Summer Sale! All accounts are 50% off this week.

Neeraj1005's avatar

Tests\Feature\ExampleTest::testBasicTest Expected status code 200 but received 404. Failed asserting that false is true.

When I run the command vendor/bin/phpunit This throw an error like this. It is just starting phase for run the phpunit testing. I did not understand the problem can anyone solve this problem?

$ vendor/bin/phpunit
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.

F..                                                                 3 / 3 (100%)

Time: 296 ms, Memory: 24.00 MB

There was 1 failure:

1) Tests\Feature\ExampleTest::testBasicTest
Expected status code 200 but received 404.
Failed asserting that false is true.

C:\xampp\htdocs\supportcrm\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:185
C:\xampp\htdocs\supportcrm\tests\Feature\ExampleTest.php:19

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

This is Feature/ExampleTest.php file code

<?php

namespace Tests\Feature;

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

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

        $response->assertStatus(200);
    }
}

And this is my route

Route::get('/','HomepageController@index');
0 likes
4 replies
orici's avatar

I have the same test result, Laravel 6. I did not edit the original web route:

Route::get('/', function () {
    return view('welcome');
});

I tryed clearing the route cache, same result.

progze's avatar

I have the same issue in laravel 8! any one find a solution, clearing cash didn't solve it ?!!

Please or to participate in this conversation.