Skip to content

Commit

Permalink
test(timeout): locks are deprecated after expiry
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Feb 5, 2025
1 parent 142e390 commit a41ab3c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Feature/LockFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use OCA\FilesLock\AppInfo\Application;
use OCA\FilesLock\Model\FileLock;
use OCA\FilesLock\Service\ConfigService;
use OCA\FilesLock\Service\LockService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\File;
use OCP\Files\IRootFolder;
Expand Down Expand Up @@ -204,6 +205,16 @@ public function testLockUserExpire() {
self::assertEquals('CCC', $file->getContent());
}

public function testExpiredLocksAreDeprecated() {
\OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 30);
$file = $this->loginAndGetUserFolder(self::TEST_USER1)
->newFile('test-expired-lock-is-deprecated', 'AAA');
$this->lockManager->lock(new LockContext($file, ILock::TYPE_USER, self::TEST_USER1));
$this->toTheFuture(3600);
$deprecated = \OCP\Server::get(LockService::class)->getDeprecatedLocks();
self::assertNotEmpty($deprecated);
}

public function testLockUserInfinite() {
\OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 0);
$file = $this->loginAndGetUserFolder(self::TEST_USER1)
Expand Down

0 comments on commit a41ab3c

Please sign in to comment.