toMatchObject, not matching eloquent model object clarification and advice. #360
Unanswered
roni-estein
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I originally thought In had noticed a bug in issue 358, however it is the intended behaviour of the expectation, here is a quick summary to save a click
Would anyone have any insights on how to go about getting that working in an eloquent model object? There are lots of times when you are testing that the correct object has been retrieved from a query or a complete relationship where the object will not be identical, for example a relationship might have been loaded since the model was created, or a timestamp may have changed, that will make items unequal.
Prior to pest I loved using assertJsonSubset, on two models and comparing equality based in specific criteria, which is what it looked like toMatchObject did. Anyhow, if someone has a moment to discuss this and the best way to accomplish this in pest I would be grateful.
Beta Was this translation helpful? Give feedback.
All reactions