sebastianbergmann / phpunit-mock-objects

Mock Object library for PHPUnit
https://phpunit.de/
Other
4.97k stars 153 forks source link

Check type of expected invoke count #352

Closed ghost closed 7 years ago

ghost commented 7 years ago

Recently I encountered this issue:

Method was expected to be called 1 times, actually called 1 times.

While technically correct, it was time consuming to figure out why this happened. In this case it was because I was using a dataProvider and was programatically setting the expected count like this:

$mock->expects($this->exactly(ceil($anInteger / $something))->method('foo');

As such it was comparing floats and integers and the expected output does not reflect that.

I hope these changes will improve on that.

sebastianbergmann commented 7 years ago

Thank you for your contribution. I am sorry that I did not get around to review/merge this sooner. Please send a new pull request against current master.