Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-10-06 23:13:44 +0300
committerGitHub <noreply@github.com>2020-10-06 23:13:44 +0300
commit2adfb27007444d042fa128b523e8e796d0494fd3 (patch)
tree5143ee10bfeaad454625ac60740763d4e001b7c3 /apps
parentca5e8d2093e48ba7f331e4628981ecc1c0bc2a68 (diff)
parent00bca0fe3eb90b089521671cde8fbde02f07f800 (diff)
Merge pull request #23129 from nextcloud/enh/noid/tests-user-status
More tests for user_status
Diffstat (limited to 'apps')
-rw-r--r--apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php4
-rw-r--r--apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php24
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'));
+ }
}