phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 241 forks source link

I think these expected/actual are the wrong way around #530

Closed toby-griffiths closed 1 year ago

toby-griffiths commented 3 years ago

I've just been trying t debug an issue with a failing method call, and in the process I spotted that what it was claiming was the actual, was in fact the expected value, and vice versa.

I tracked the issue down to this line, which seems to me to pass in the arguments the wrong way around…

https://github.com/phpspec/prophecy/blob/be1996ed8adc35c3fd795488a653f4b518be70ea/src/Prophecy/Argument/Token/ExactValueToken.php#L60

Am I wrong in thinking that the argument being scored should be the actual value, and the $this->value be the expected one when passing them to assertEquals()?

stof commented 3 years ago

well, given that the failure message is never used, I don't think swapping them has a big impact. Do you faced an actual issue caused by that ?

toby-griffiths commented 3 years ago

@stof I see your point. I think I just must have spotted it whilst step debugging, but I realise now it doen't actually make a difference.