fix(tests): Make timing test more reliable

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/48344/head
Joas Schilling 2024-09-24 07:00:19 +07:00
parent 2ff103cb87
commit ec6ed0cf74
No known key found for this signature in database
GPG Key ID: F72FA5B49FFA96B0
1 changed files with 4 additions and 1 deletions

@ -42,17 +42,20 @@ class StatusServiceIntegrationTest extends TestCase {
}
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 {