I’ve test method that only validate if a mock method is called twice.
When it fail, I would like to provide the user with an error message.
How can I do so ?
Code sample:
public function testUpdate()
{
$emMock = $this->mockEntityManager(
array('persist', 'flush'),
array('name')
);
$srv = new Service($emMock);
$entity = $srv->create();
$emMock
->expects($this->exactly(2))
->method('persist');
$emMock
->expects($this->exactly(3)) //Should give an error message
->method('flush');
$srv->update($entity);
}
Throw an exception when failure