Recommended way to test Carbon in expect
#326
Answered
by
nunomaduro
JasonTheAdams
asked this question in
Q&A
-
Hi! 👋 I was recently trying to do something like this: // Not same instance
expect($token)
->expiration->toBe($expirationDate);
// Doesn't seem to know how to handle this
expect($token)
->expiration->format('U')->toBe($expirationDate->format->('U'));
// Works
assertSame($expirationDate->format('U'), $token->expiration->format('U')); I like the Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
nunomaduro
Jun 19, 2021
Replies: 2 comments 6 replies
Answer selected by
JasonTheAdams
-
Any reason you can't use toEqual in the first example? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cc @lukeraymonddowning