nunomaduro / laravel-mojito

🍹 A lightweight package for testing Laravel views in isolation
http://nunomaduro.com/
MIT License
373 stars 16 forks source link

Bug (#15) sprintf breaks tests when a matching strings contains '%' #16

Closed SimoTod closed 4 years ago

SimoTod commented 4 years ago

Closes #15 As suggested in that thread I removed sprintf in favour of string interpolation. The performance impact, if existing, is negligible and this version is easier to read. I've added some test to make sure that the message format didn't change plus one test to address this specific bug in a miscellanea class. Since ViewAssertion::assert is private, it's safe and not a breaking change.

For some reasons, I didn't get a notification for this and the other ticket. I believe it was because I hadn't clicked 'watch'. It's sorted now, I should get the alert next time, thanks for the heads up.

SimoTod commented 4 years ago

The last version passed the previous was failing in php 7.2. For some reason one of the selectors was also returning a newline after the tag but only in php 7.2 and since I printed the full message, it was failing the comparison. I can have a look and see if it makes sense to trim the selected html later/tomorrow.

SimoTod commented 4 years ago

@nunomaduro I made a couple of changes as a follow up for the conversation I had with Daniel. If you are happy with this PR i can tag a release.