Skip to content

Commit a41ab3c

Browse files
committed
test(timeout): locks are deprecated after expiry
Signed-off-by: Max <[email protected]>
1 parent 142e390 commit a41ab3c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Feature/LockFeatureTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use OCA\FilesLock\AppInfo\Application;
99
use OCA\FilesLock\Model\FileLock;
1010
use OCA\FilesLock\Service\ConfigService;
11+
use OCA\FilesLock\Service\LockService;
1112
use OCP\AppFramework\Utility\ITimeFactory;
1213
use OCP\Files\File;
1314
use OCP\Files\IRootFolder;
@@ -204,6 +205,16 @@ public function testLockUserExpire() {
204205
self::assertEquals('CCC', $file->getContent());
205206
}
206207

208+
public function testExpiredLocksAreDeprecated() {
209+
\OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 30);
210+
$file = $this->loginAndGetUserFolder(self::TEST_USER1)
211+
->newFile('test-expired-lock-is-deprecated', 'AAA');
212+
$this->lockManager->lock(new LockContext($file, ILock::TYPE_USER, self::TEST_USER1));
213+
$this->toTheFuture(3600);
214+
$deprecated = \OCP\Server::get(LockService::class)->getDeprecatedLocks();
215+
self::assertNotEmpty($deprecated);
216+
}
217+
207218
public function testLockUserInfinite() {
208219
\OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 0);
209220
$file = $this->loginAndGetUserFolder(self::TEST_USER1)

0 commit comments

Comments
 (0)