Skip to content
Prev Previous commit
Next Next commit
fix(tests): Make timing test more reliable
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Sep 25, 2024
commit 04a5e492edc84d955c2a0a5e20445ee1bb56a2ea
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,20 @@ public function testNoStatusYet(): void {
}

public function testCustomStatusMessageTimestamp(): void {
$before = time();
$this->service->setCustomMessage(
'test123',
'🍕',
'Lunch',
null,
);
$after = time();

$status = $this->service->findByUserId('test123');

self::assertSame('Lunch', $status->getCustomMessage());
self::assertGreaterThanOrEqual(time(), $status->getStatusMessageTimestamp());
self::assertGreaterThanOrEqual($before, $status->getStatusMessageTimestamp());
self::assertLessThanOrEqual($after, $status->getStatusMessageTimestamp());
}

public function testOnlineStatusKeepsMessageTimestamp(): void {
Expand Down