You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my experience with mockery, a number of times I have found myself needing to return an argument that was passed to a mocked method. In such cases, I have done something like this:
This feels really clunky and boilerplatey, but is something commonly required for mocks of classes that do normalisation or follow the decorator pattern.
Seeing as PHPUnit has had this functionality for a long time, I feel we should introduce it into Mockery too. I propose we add the following syntax to enable returning arguments
$mock->shouldReceive("myMethod")->andReturnArgument(2);
// where "2" is the index of the argument to return
Do you think this is something that can be implemented?
The text was updated successfully, but these errors were encountered:
Hi
In my experience with mockery, a number of times I have found myself needing to return an argument that was passed to a mocked method. In such cases, I have done something like this:
This feels really clunky and boilerplatey, but is something commonly required for mocks of classes that do normalisation or follow the decorator pattern.
Seeing as PHPUnit has had this functionality for a long time, I feel we should introduce it into Mockery too. I propose we add the following syntax to enable returning arguments
Do you think this is something that can be implemented?
The text was updated successfully, but these errors were encountered: