How can I make it so in PHPUnit a mocked method returns its passed argument?
E.g:
$redirector->expects( $this->once() )->method('gotoUrl')->will( $this->returnValue($argument) );
As per the PHPUnit manual:
$stub->expects($this->any())
->method('doSomething')
->will($this->returnArgument(0));
$redirector->expects($this->once())
->method('gotoUrl')
->will($this->returnCallback(function() {
$args = func_get_args();
return $args[0]; // or w/e
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With