Skip to content

Commit

Permalink
Make expectation closure optional for mock and spy instances (#26242)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorbitzer authored and taylorotwell committed Oct 24, 2018
1 parent 1dffa1a commit de266be
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ protected function instance($abstract, $instance)
* Mock an instance of an object in the container.
*
* @param string $abstract
* @param \Closure $instance
* @param \Closure|null $instance
* @return object
*/
protected function mock($abstract, Closure $mock)
protected function mock($abstract, Closure $mock = null)
{
return $this->instance($abstract, Mockery::mock($abstract, $mock));
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args())));
}

/**
* Spy an instance of an object in the container.
*
* @param string $abstract
* @param \Closure $instance
* @param \Closure|null $instance
* @return object
*/
protected function spy($abstract, Closure $mock)
protected function spy($abstract, Closure $mock = null)
{
return $this->instance($abstract, Mockery::spy($abstract, $mock));
return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args())));
}
}

0 comments on commit de266be

Please sign in to comment.