I got a problem with my PHPUnit test. I have a method like:
public function bla()
{
$this->blub();
}
$_testObject is a mocked instance of Foo, like this:
public function setUp()
{
$this->_testObject = $this->getMockBuilder('Foo')
->setMethods(array('blub'))
->getMock();
}
My test method is like:
/**
* @test
* @covers Foo::bla
*/
public function shouldCallBlubOnce()
{
$this->_testObject->expects($this->once())
->method('blub');
//forgot this one :D
$this->_testObject->bla();
}
Result of this test delivers:
PHPUnit_Framework_ExpectationFailedException :
Expectation failed for method name is equal to <string:blub> when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.
Thanks in advance. :)