aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/tests
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-06-03 15:29:50 +0200
committerGitHub <noreply@github.com>2022-06-03 15:29:50 +0200
commit57c686e1247e3249634a8e93b3c7168a67d0fb9d (patch)
tree3e10337b0ce51af24492895fd3faf3bc5755cadc /apps/user_status/tests
parent8e59d49701c43a43ab0ce70d5f17bde0167187eb (diff)
parent1429a9a8ef9c65493e0c9276c4cc5f8b8cf94bc2 (diff)
downloadnextcloud-server-57c686e1247e3249634a8e93b3c7168a67d0fb9d.tar.gz
nextcloud-server-57c686e1247e3249634a8e93b3c7168a67d0fb9d.zip
Merge pull request #32620 from nextcloud/bugfix/noid/reset-status-on-clearAt
Also reset the status on clearAt
Diffstat (limited to 'apps/user_status/tests')
-rw-r--r--apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php2
-rw-r--r--apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php3
-rw-r--r--apps/user_status/tests/Unit/Db/UserStatusMapperTest.php17
3 files changed, 9 insertions, 13 deletions
diff --git a/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php b/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
index 2cf9b7d1bd4..da3b342f1a7 100644
--- a/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
+++ b/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
@@ -53,7 +53,7 @@ class ClearOldStatusesBackgroundJobTest extends TestCase {
public function testRun() {
$this->mapper->expects($this->once())
- ->method('clearMessagesOlderThan')
+ ->method('clearOlderThanClearAt')
->with(1337);
$this->mapper->expects($this->once())
->method('clearStatusesOlderThan')
diff --git a/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php b/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php
index 916f5447ea4..e4d2ab61eee 100644
--- a/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php
+++ b/apps/user_status/tests/Unit/Controller/UserStatusControllerTest.php
@@ -315,7 +315,8 @@ class UserStatusControllerTest extends TestCase {
public function setCustomMessageDataProvider(): array {
return [
['👨🏽‍💻', 'Busy developing the status feature', 500, true, false, null, false, null],
- ['👨🏽‍💻', '', 500, true, false, null, false, null, true],
+ ['👨🏽‍💻', '', 500, true, false, null, false, null, false],
+ ['👨🏽‍💻', '', 0, true, false, null, false, null, true],
['👨🏽‍💻', 'Busy developing the status feature', 500, false, true, new InvalidClearAtException('Original exception message'), true,
'New user-status for "john.doe" was rejected due to an invalid clearAt value "500"'],
['👨🏽‍💻', 'Busy developing the status feature', 500, false, true, new InvalidStatusIconException('Original exception message'), true,
diff --git a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php
index 0d9f1c1f718..577277cfd61 100644
--- a/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php
+++ b/apps/user_status/tests/Unit/Db/UserStatusMapperTest.php
@@ -28,6 +28,7 @@ namespace OCA\UserStatus\Tests\Db;
use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Db\UserStatusMapper;
+use OCP\AppFramework\Db\DoesNotExistException;
use OCP\DB\Exception;
use Test\TestCase;
@@ -204,22 +205,16 @@ class UserStatusMapperTest extends TestCase {
];
}
- public function testClearMessagesOlderThan(): void {
+ public function testClearOlderThanClearAt(): void {
$this->insertSampleStatuses();
- $this->mapper->clearMessagesOlderThan(55000);
+ $this->mapper->clearOlderThanClearAt(55000);
$allStatuses = $this->mapper->findAll();
- $this->assertCount(3, $allStatuses);
+ $this->assertCount(2, $allStatuses);
- $user1Status = $this->mapper->findByUserId('user1');
- $this->assertEquals('user1', $user1Status->getUserId());
- $this->assertEquals('dnd', $user1Status->getStatus());
- $this->assertEquals(5000, $user1Status->getStatusTimestamp());
- $this->assertEquals(true, $user1Status->getIsUserDefined());
- $this->assertEquals(null, $user1Status->getCustomIcon());
- $this->assertEquals(null, $user1Status->getCustomMessage());
- $this->assertEquals(null, $user1Status->getClearAt());
+ $this->expectException(DoesNotExistException::class);
+ $this->mapper->findByUserId('user1');
}
private function insertSampleStatuses(): void {