I'm trying to test a Laravel api. When I try to create a partial mock with the Eloquent Model fill method, phpunit throws an error.
Code
$mock = m::mock('App\User', [])->makePartial();
$mock->shouldReceive('fill')->once()->andReturn('ok');
$result = $mock->fill([]);
var_dump($result);
Error
PHP Fatal error: Call to a member function __call() on a non-object
PHP Fatal error: Uncaught exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable.
I really don't know if this either a Eloquent bug, or a Mockery error.
Notes:
I temporarily solved this problem using Model::update method instead of Model::fill and then Model::save, but I still want to know how to mock the fill method.
Links
http://laravel.com/api/5.0/Illuminate/Database/Eloquent/Model.html#method_fill