samedi 28 janvier 2017

Laravel unit tests - controller method

I want your help about a testing class, i have some test method that failed in those two methods, here where it fails:

    class PhotoControllerTest extends TestCase

{
public function testUpdate()
    {
        $photo=$this->json('POST', '/photo', ['id' => 1, 'name' => 'photoExample']);
        $this->json('PUT','/vertical/1',['id' => 1,'name' => 'photo2') ->seeJson(['success' => true,'photo'=>true] );

    }
 public function testDestroy()
    {
        $photo =$this->json('POST', '/photo', ['id' => 2,'name' => 'photo');
        $this->json('DELETE', '/photo/2') ->seeJson(['success'=>true]);
    }
}

What I'm trying to do is to test an update method, by storing a photo, and then trying to update it, same thing with destroy methos, any idea please ?

Thanks in advance !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire