public function shouldReceive($methodName)
{
if (func_num_args() < 1) {
throw new \InvalidArgumentException("At least one method name is required");
}
foreach (func_get_args() as $method) {
if ("" == $method) {
throw new \InvalidArgumentException("Received empty method name");
}
}
/** @var array $nonPublicMethods */
$nonPublicMethods = $this->getNonPublicMethods();
$self = $this;
$allowMockingProtectedMethods = $this->_mockery_allowMockingProtectedMethods;
$lastExpectation = \Mockery::parseShouldReturnArgs($this, func_get_args(), function ($method) use($self, $nonPublicMethods, $allowMockingProtectedMethods) {
$rm = $self->mockery_getMethod($method);
if ($rm) {
if ($rm->isPrivate()) {
throw new \InvalidArgumentException("{$method}() cannot be mocked as it is a private method");
}
if (!$allowMockingProtectedMethods && $rm->isProtected()) {
throw new \InvalidArgumentException("{$method}() cannot be mocked as it is a protected method and mocking protected methods is not enabled for the currently used mock object.");
}
}
$director = $self->mockery_getExpectationsFor($method);
if (!$director) {
$director = new \Mockery\ExpectationDirector($method, $self);
$self->mockery_setExpectationsFor($method, $director);
}
$expectation = new \Mockery\Expectation($self, $method);
$director->addExpectation($expectation);
return $expectation;
});
return $lastExpectation;
}