samedi 22 septembre 2018

Laravel feature testing problem for update/edit method

I need code example of feature laravel HTTP testing for multiple update method. Update(PUT methode) has 3 parametars (name, mail and password). I coded for "get","crete" and "delete", but I got difficulties with update. I don't have any idea from where I should need to start code. So, i will be thankful if anybody can help me with it, eve with hint,idea or example.

Code looks like this (but I think thaht is completely useless)

 Class UserRoutesTest extends TestCase 
 {

  public function test_update()
  {
     $response= $this->json('GET', 'my_route');

     $update = $this->json('PUT', 'my_route' . $user->id, [
             'name'='updatedname', 'email' => 'updatedemail', 
             'password'=>'updatedpassword'
              ]);

     $update->assertStatus(200);
     $update->assertJson([
     'status' => 'success'
       ]);

  }   

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire