Skip to content

Commit cd7e7c6

Browse files
leftybournesAndyScherzinger
authored andcommitted
test: add test for new getDisplayUser() method in OC\User\Manager
Signed-off-by: Kent Delante <kent@delante.me> Assisted-by: ClaudeCode:claude-sonnet-5
1 parent 64e24a4 commit cd7e7c6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/lib/User/ManagerTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OC\User\User;
1616
use OCP\Config\IUserConfig;
1717
use OCP\EventDispatcher\IEventDispatcher;
18+
use OCP\Federation\ICloudId;
1819
use OCP\ICache;
1920
use OCP\ICacheFactory;
2021
use OCP\IConfig;
@@ -762,4 +763,18 @@ public function testGetExistingUser() {
762763
$this->assertEquals('nobody', $user->getUID());
763764
$this->assertEquals('None', $user->getDisplayName());
764765
}
766+
767+
public function testGetFederatedUser(): void {
768+
$userId = 'test@example.com';
769+
770+
$cloudId = $this->createMock(ICloudId::class);
771+
$cloudId->expects($this->exactly(2))
772+
->method('getDisplayId')
773+
->willReturn($userId);
774+
775+
$user = $this->manager->getFederatedUser($cloudId);
776+
777+
$this->assertEquals($userId, $user->getUID());
778+
$this->assertEquals($userId, $user->getDisplayName());
779+
}
765780
}

0 commit comments

Comments
 (0)