I try to mock just one function form reposiory but I get this error:
Method Mockery_1_App_Repositories_CommentInterface::updateAccepted() does not exist on this mock object
But I don't want the updateAccepted method be mocked...
Here is my test:
public function testUpdateAcceptedApi(){
$user = new User(array('name' => 'John','id'=>1));
$this->be($user);
$mock = m::mock('App\Repositories\UserAuthInterface');
$mock->shouldReceive('hasRoleClient')->once()->andReturn(true);
App::instance('App\Repositories\UserAuthInterface', $mock);
$mock1 = m::mock('App\Repositories\CommentInterface');
$mock1->shouldReceive('returnUserProject')->once()->andReturn(2);
App::instance('App\Repositories\CommentInterface', $mock1);
$response = $this->call('POST', 'api/comment/accepted', array(
'accepted' => 1,
'id' => 1
));
echo "SUCCESFUL UPDATE ACCEPT REQUEST\n";
$this->assertEquals('Success', $response->getContent());
}
Any idea how to not mock updateAccepted method inside rep?
Aucun commentaire:
Enregistrer un commentaire