diff --git a/tests/Feature/LockFeatureTest.php b/tests/Feature/LockFeatureTest.php index 82d4ed42..70d32e66 100644 --- a/tests/Feature/LockFeatureTest.php +++ b/tests/Feature/LockFeatureTest.php @@ -7,6 +7,7 @@ use OC\Files\Lock\LockManager; use OCA\FilesLock\AppInfo\Application; use OCA\FilesLock\Service\ConfigService; +use OCA\FilesLock\Service\LockService; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\IRootFolder; use OCP\Files\Lock\ILock; @@ -195,6 +196,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() { \OC::$server->getConfig()->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 0); $file = $this->loginAndGetUserFolder(self::TEST_USER1)