E
E
easyWay12017-03-19 13:12:01
PHP
easyWay1, 2017-03-19 13:12:01

Why is it necessary to control the call count wait in a function in mock objects?

Good afternoon!
I'm currently learning unit testing. Everything is clear, except for one thing: I don’t understand why unit tests control the number of function calls.
First, a mock object is created.
$mock->expects($this->once()) or other number of calls.
Why is such a design needed? Is it possible to see a practical example of where exactly it needs to be called once and why it is needed?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question