code:
class MockMe
{
public function mockMeee()
{
return 'Im not mocked';
}
}
test:
$sut = new MockMe();
$this
->getMock(get_class($sut))
->expects($this->any())
->method('mockMeee')
->will($this->returnValue('Im finally mocked'));
echo $sut->mockMeee();
this outputs the original "Im not mocked"
, but it supposed to send the Im finally mocked
text. What is wrong?
EDIT: done:
$stub = $this->getMock('MockMe');
$stub->method('mockMeee')->willReturn('Im finally mocked');
echo $stub->mockMeee();