Merge pull request #23129 from nextcloud/enh/noid/tests-user-status

More tests for user_status
This commit is contained in:
Morris Jobke 2020-10-06 22:13:44 +02:00 committed by GitHub
commit 2adfb27007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -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],
];
}

View File

@ -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'));
}
}