class to be tested:
class Arithmetic
{
public function mockme($param1 = 0, $param2 = 0)
{
echo 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';die;
}
public function mockme2()
{
$this->mockme('a', 'b');
}
}
to test it:
public function testMock()
{
$mock = $this->getMock('Arithmetic', array('mockme'));
$mock->expects($this->once())->method('mockme')->with();
$mock->mockme2();
}
now it passes however not supposed to be. Why? The with()
is given. I expect that no parameter must be passed to mockme()
- so with()
shouldve expected empty parameters. But now its like I didnt set it at all. In other words: if I set with(1,4)
its a must to pass 1,4. If I set with('a')
, its a must to pass 'a'. If I set nothing with()
its a must not to pass anything (but it regards it like I didnt set any with()
)