Some Testing Techniques
● Use data providers
● Setting expected exception before the call to tests
● Anonymous function for complex param assertion (returnCallback())
○ with(‘p1’, ‘p2’) / withConsecutive([[‘p1’, ‘p2’], [‘p21’, ‘p22’]])
● Anonymous functions for complex expected returns (returnCallback())
○ $this->willReturn(‘foo’) / $this->will($this->return(‘foo’))
○ $this->will(returnArgument(0) / onConsecutiveCalls([‘r1’, ‘r2’]) / returnValueMap([‘p1’, ‘p2’, ‘r’]))