Merge pull request #23129 from nextcloud/enh/noid/tests-user-status
More tests for user_status
This commit is contained in:
commit
2adfb27007
|
@ -99,7 +99,7 @@ class UserLiveStatusListenerTest extends TestCase {
|
||||||
$user->method('getUID')->willReturn($userId);
|
$user->method('getUID')->willReturn($userId);
|
||||||
$event = new UserLiveStatusEvent($user, $eventStatus, $eventTimestamp);
|
$event = new UserLiveStatusEvent($user, $eventStatus, $eventTimestamp);
|
||||||
|
|
||||||
$this->timeFactory->expects($this->once())
|
$this->timeFactory->expects($this->atMost(1))
|
||||||
->method('getTime')
|
->method('getTime')
|
||||||
->willReturn(5000);
|
->willReturn(5000);
|
||||||
|
|
||||||
|
@ -149,6 +149,8 @@ class UserLiveStatusListenerTest extends TestCase {
|
||||||
['john.doe', 'online', 5000, false, 'online', 5000, false, true],
|
['john.doe', 'online', 5000, false, 'online', 5000, false, true],
|
||||||
['john.doe', 'away', 5000, false, 'online', 5000, true, true],
|
['john.doe', 'away', 5000, false, 'online', 5000, true, true],
|
||||||
['john.doe', 'online', 5000, false, 'away', 5000, true, false],
|
['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],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,4 +181,28 @@ class PredefinedStatusServiceTest extends TestCase {
|
||||||
['unknown-id', false],
|
['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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue