Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Call to undefined method Tests\Unit\SomeTest::assertStatus()

I wrote the test:

$response = $this->get('/something');
$response->assertStatus(200);

It displays this error:

Error: Call to undefined method Tests\Unit\SomeTest::assertStatus()

I found how I can fix my problem (code is below) but I want to use first method:

  $response = $this->get('/something');

  $this->assertEquals(200, $this->response->status());

Why doesn't the first code work?

like image 277
helloRoman5556 Avatar asked Nov 27 '19 16:11

helloRoman5556


1 Answers

I solved it by changing use PHPUnit\Framework\TestCase to use Tests\TestCase.

like image 163
Amirhossein Shahbazi Avatar answered Nov 15 '22 15:11

Amirhossein Shahbazi