Assignments in mock return values
- by zerkms
(I will show examples using php and phpunit but this may be applied to any programming language)
The case: let's say we have a method A::foo that delegates some work to class M and returns the value as-is.
Which of these solutions would you choose:
$mock = $this->getMock('M');
$mock->expects($this->once())
->method('bar')
…