Rbex
Rbex

Reputation: 1539

PHPUnit Testing Laravel

I can't figure this one out in PHPUnit. In Postman it works well but in PHPUnit there is an error.

class MyPageTakumoiTest extends TestCase
{
    protected $api = "/api/my_page_takumoi/2";

    public function testUpdate()
    {

        $response = $this->json('PUT', $this->api, [
            'family_name' => 'new kk',
        ]);

        $response->assertStatus(200);

    }
}

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

enter image description here

Upvotes: 0

Views: 62

Answers (1)

ATholin
ATholin

Reputation: 158

You can use this at the start of your test to get a better exception:

$this->withoutExceptionHandling();

Upvotes: 1

Related Questions