Search code examples
laravellaravel-testing

Test.Error Expected status code 200 but received 200.How to fix it?


I created test for CompanyController,

public function testCompanyIndex()
    {
        $user = factory(User::class)->create();
        $response = $this->actingAs($user, 'web')->get('company/index');
        $response->assertStatus('200');
    }

but i have an error:

1) Tests\Feature\CompanyTest::testCompanyIndex Expected status code 200 but received 200. Failed asserting that false is true.

In CompanyController i have middleware auth:web.CompanyController@index returns all Companies.


Solution

  • just remove quotes like this $response->assertStatus(200); for more details click here