Skip to content

Commit

Permalink
test: Use microtime to set lastLogin
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
Altahrim authored and artonge committed Oct 24, 2024
1 parent 5cce50a commit cec4852
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/lib/User/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,23 +673,23 @@ public function testRecentlyActive(): void {
$manager = \OCP\Server::get(IUserManager::class);

// Create some users
$now = (string)time();
$now = microtime();
$user1 = $manager->createUser('test_active_1', 'test_active_1');
$config->setUserValue('test_active_1', 'login', 'lastLogin', $now);
$config->setUserValue('test_active_1', 'login', 'lastLogin', (string)$now);
$user1->setDisplayName('test active 1');
$user1->setSystemEMailAddress('roger@active.com');

$user2 = $manager->createUser('TEST_ACTIVE_2_FRED', 'TEST_ACTIVE_2');
$config->setUserValue('TEST_ACTIVE_2_FRED', 'login', 'lastLogin', $now);
$config->setUserValue('TEST_ACTIVE_2_FRED', 'login', 'lastLogin', (string)$now);
$user2->setDisplayName('TEST ACTIVE 2 UPPER');
$user2->setSystemEMailAddress('Fred@Active.Com');

$user3 = $manager->createUser('test_active_3', 'test_active_3');
$config->setUserValue('test_active_3', 'login', 'lastLogin', $now + 1);
$config->setUserValue('test_active_3', 'login', 'lastLogin', (string)($now + 1));
$user3->setDisplayName('test active 3');

$user4 = $manager->createUser('test_active_4', 'test_active_4');
$config->setUserValue('test_active_4', 'login', 'lastLogin', $now);
$config->setUserValue('test_active_4', 'login', 'lastLogin', (string)$now);
$user4->setDisplayName('Test Active 4');

$user5 = $manager->createUser('test_inactive_1', 'test_inactive_1');
Expand Down Expand Up @@ -722,6 +722,12 @@ public function testRecentlyActive(): void {
$user3->delete();
$user4->delete();
$user5->delete();

$config->deleteAllUserValues($user1->getUID());
$config->deleteAllUserValues($user2->getUID());
$config->deleteAllUserValues($user3->getUID());
$config->deleteAllUserValues($user4->getUID());
$config->deleteAllUserValues($user5->getUID());
}

public function testDeleteUser(): void {
Expand Down

0 comments on commit cec4852

Please sign in to comment.