mercredi 30 janvier 2019

assertJson and assertSee show call to a null member error

I trying to develop a test for my APIs,

This is my code:

public function testFirstAPI()
    {
        $user = \User::find(1);
        $r = $this
            ->actingAs($user)
            ->json('put', route('updateUser'),['lock' => 'true']);
        $r->assertResponseStatus(200)->seeJson(['success' => true]);
    }

this test will work and when I use $r->dump() I can found the success in the response.

but I don't know why seeJson show this error:

Symfony\Component\Debug\Exception\FatalErrorException]
  Call to a member function assertJson() on null



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire