Mock in PHPUnit - multiple configuration of the same method with different arguments

前端 未结 7 734
死守一世寂寞
死守一世寂寞 2020-11-29 22:26

Is it possible to configure PHPUnit mock in this way?

$context = $this->getMockBuilder(\'Context\')
   ->getMock();

$context->expects($this->any         


        
7条回答
  •  自闭症患者
    2020-11-29 23:00

    As of PHPUnit 3.6, there is $this->returnValueMap() which may be used to return different values depending on the given parameters to the method stub.

提交回复
热议问题