Skip to content

Commit

Permalink
Check new interface method, ensure fractional seconds are not lost
Browse files Browse the repository at this point in the history
  • Loading branch information
Firehed committed Mar 2, 2024
1 parent d600cce commit c9ab1aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ExpiringChallenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @phpstan-type SerializationFormat array{
* c: string,
* e: int,
* e: numeric-string,
* }
*/
class ExpiringChallenge implements ChallengeInterface
Expand Down Expand Up @@ -92,7 +92,7 @@ public function __serialize(): array
{
return [
'c' => $this->wrapped->getBase64(),
'e' => $this->expiration->getTimestamp(),
'e' => $this->expiration->format('U.u'),
];
}

Expand Down
5 changes: 5 additions & 0 deletions tests/ChallengeInterfaceTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public function testSerializationRoundTrip(): void
$unserialized->getBase64(),
'Base64 changed',
);

self::assertEquals(
$challenge->getExpiration(),
$unserialized->getExpiration(),
);
}

public function testBinaryMatchesBase64(): void
Expand Down

0 comments on commit c9ab1aa

Please sign in to comment.