mercredi 26 juin 2019

Cant create my own facade and test it with Mocking

I am trying to create tests for a class that does some API calls to another program, and i dont want to send petitions when im testing my code.

I used the "extend Facade" on my class, and i get an error when i try to use the "shouldReceive".

 MyClass::shouldReceive('update')
            ->once()
            ->with([
                'id' => 1
            ])
            ->andReturn(200);

The error is: Cannot redeclare Mockery_3_MyClass::shouldReceive()

Aucun commentaire:

Enregistrer un commentaire