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! |
Answered by
nunomaduro
Jun 19, 2021
Replies: 3 comments 7 replies
4 replies
Answer selected by
JasonTheAdams
|
Any reason you can't use toEqual in the first example? |
2 replies
|
Just to clarify, we still have to use something like: expect($someDateTime->unix())->toBe($expectedDateTime->unix());and expect($someDateTime)->toBe($theExpectedDateTime);will never work, right? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cc @lukeraymonddowning