We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not sure if this is a bug or a proposal. It seems like it should be possible to add multiple expectations to a Facade. You can do it now like this:
$mock = View::shouldReceive('make')->andReturn(\Mockery::self())->getMock(); $mock->shouldReceive('with')->andReturn(self::RESPONSE);
But it would be cleaner, I think, if you could do it like this:
View::shouldReceive('make')->andReturn(\Mockery::self()); View::shouldReceive('with')->andReturn(self::RESPONSE);
Currently, that will throw an error "Cannot redeclare Mockery_...".
This could be solved if shouldReceive first checked to see if there is already a mock of this facade, and used that mock if there is one.
public static function shouldReceive() { $name = static::getFacadeAccessor(); if (isset(static::$resolvedInstance[$name]) && strpos(get_class(static::$resolvedInstance[$name]), 'Mockery') !== false) { $mock = static::$resolvedInstance[$name]; } else { static::$resolvedInstance[$name] = $mock = \Mockery::mock(get_class(static::getFacadeRoot())); static::$app->instance($name, $mock); } return call_user_func_array(array($mock, 'shouldReceive'), func_get_args()); }
There is probably a cleaner way of checking if there is a mock, but something like this should allow multiple expectations with a cleaner syntax.
The text was updated successfully, but these errors were encountered:
I like this implementation.
Sorry, something went wrong.
I've replaced this with this pull request: #539 it seemed more like a bug that a proposal for a new feature anyway.
Merge pull request laravel#364 from eurides-eu/open-api-docs
de99ab9
Add api docs Fixes laravel#240
No branches or pull requests
Not sure if this is a bug or a proposal.
It seems like it should be possible to add multiple expectations to a Facade.
You can do it now like this:
But it would be cleaner, I think, if you could do it like this:
Currently, that will throw an error "Cannot redeclare Mockery_...".
This could be solved if shouldReceive first checked to see if there is already a mock of this facade, and used that mock if there is one.
There is probably a cleaner way of checking if there is a mock, but something like this should allow multiple expectations with a cleaner syntax.
The text was updated successfully, but these errors were encountered: