diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-10-06 22:13:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 22:13:44 +0200 |
commit | 2adfb27007444d042fa128b523e8e796d0494fd3 (patch) | |
tree | 5143ee10bfeaad454625ac60740763d4e001b7c3 /apps/user_status/tests | |
parent | ca5e8d2093e48ba7f331e4628981ecc1c0bc2a68 (diff) | |
parent | 00bca0fe3eb90b089521671cde8fbde02f07f800 (diff) | |
download | nextcloud-server-2adfb27007444d042fa128b523e8e796d0494fd3.tar.gz nextcloud-server-2adfb27007444d042fa128b523e8e796d0494fd3.zip |
Merge pull request #23129 from nextcloud/enh/noid/tests-user-status
More tests for user_status
Diffstat (limited to 'apps/user_status/tests')
-rw-r--r-- | apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php | 4 | ||||
-rw-r--r-- | apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php | 24 |
2 files changed, 27 insertions, 1 deletions
diff --git a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php index 29f444ece0b..ff12628ba70 100644 --- a/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php +++ b/apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php @@ -99,7 +99,7 @@ class UserLiveStatusListenerTest extends TestCase { $user->method('getUID')->willReturn($userId); $event = new UserLiveStatusEvent($user, $eventStatus, $eventTimestamp); - $this->timeFactory->expects($this->once()) + $this->timeFactory->expects($this->atMost(1)) ->method('getTime') ->willReturn(5000); @@ -149,6 +149,8 @@ class UserLiveStatusListenerTest extends TestCase { ['john.doe', 'online', 5000, false, 'online', 5000, false, true], ['john.doe', 'away', 5000, false, 'online', 5000, true, true], ['john.doe', 'online', 5000, false, 'away', 5000, true, false], + ['john.doe', 'away', 5000, true, 'online', 5000, true, false], + ['john.doe', 'online', 5000, true, 'away', 5000, true, false], ]; } diff --git a/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php b/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php index 2f58b5b1df8..f0634c7fbe8 100644 --- a/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php +++ b/apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php @@ -181,4 +181,28 @@ class PredefinedStatusServiceTest extends TestCase { ['unknown-id', false], ]; } + + public function testGetDefaultStatusById(): void { + $this->l10n->expects($this->exactly(5)) + ->method('t') + ->withConsecutive( + ['In a meeting'], + ['Commuting'], + ['Working remotely'], + ['Out sick'], + ['Vacationing'] + ) + ->willReturnArgument(0); + + $this->assertEquals([ + 'id' => 'vacationing', + 'icon' => '🌴', + 'message' => 'Vacationing', + 'clearAt' => null, + ], $this->service->getDefaultStatusById('vacationing')); + } + + public function testGetDefaultStatusByUnknownId(): void { + $this->assertNull($this->service->getDefaultStatusById('unknown')); + } } |