php - Laravel 5 and Mockery, doesn't work -
i've been debugging line per line , seems error comes when try bind repository mock:
$mock = mockery::mock('mynamespace\repositories\mymodelinterfacerepository'); // error in line $this->app->instance('mynamespace\repositories\mymodelinterfacerepository', $mock);
i bound repo interface , implementation , works on browser, it fails in test case, giving me error 500.
my controller's constructor goes this:
use mynamespace\repositories\mymodelinterfacerepository; class mycontroller extends controller { public function __construct(mymodelinterfacerepository $repo) { $this->repo = $repo; } ....
any ideas?
edit:
here log. seems view not receiving proper foreach
argument, possibly caused because mock call returning null
.
for encounters problem, in case, should controller validate if returned value null (considering eloquent return empty array if no records, never null), or should mockery
make sure returns value?
Comments
Post a Comment