Recommended way to test Carbon in expect
#326
-
|
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.
Replies: 3 comments 7 replies
-
Beta Was this translation helpful? Give feedback.
-
|
Any reason you can't use toEqual in the first example? |
Beta Was this translation helpful? Give feedback.
-
|
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? |
Beta Was this translation helpful? Give feedback.
cc @lukeraymonddowning