I was looking to get different return values for the same method while calling it multiple times. I tried many things but did not get an exact answer for this.
$mock = $this->getMockBuilder('Test') ->disableOriginalConstructor() ->setMethods(array('testMethod')) ->getMock(); $mock->expects($this->once())->method('testMethod')->will($this->returnValue(true)); $mock->expects($this->second())->method('testMethod')->will($this->returnValue(false));