|
7 | 7 | use OC\Files\Lock\LockManager;
|
8 | 8 | use OCA\FilesLock\AppInfo\Application;
|
9 | 9 | use OCA\FilesLock\Service\ConfigService;
|
| 10 | +use OCA\FilesLock\Service\LockService; |
10 | 11 | use OCP\AppFramework\Utility\ITimeFactory;
|
11 | 12 | use OCP\Files\IRootFolder;
|
12 | 13 | use OCP\Files\Lock\ILock;
|
13 | 14 | use OCP\Files\Lock\ILockManager;
|
14 | 15 | use OCP\Files\Lock\LockContext;
|
| 16 | +use OCP\IConfig; |
15 | 17 | use OCP\Lock\ManuallyLockedException;
|
16 | 18 | use OCP\Share\IManager as IShareManager;
|
17 | 19 | use OCP\Share\IShare;
|
@@ -195,6 +197,16 @@ public function testLockUserExpire() {
|
195 | 197 | self::assertEquals('CCC', $file->getContent());
|
196 | 198 | }
|
197 | 199 |
|
| 200 | + public function testExpiredLocksAreDeprecated() { |
| 201 | + \OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 30); |
| 202 | + $file = $this->loginAndGetUserFolder(self::TEST_USER1) |
| 203 | + ->newFile('test-expired-lock-is-deprecated', 'AAA'); |
| 204 | + $this->lockManager->lock(new LockContext($file, ILock::TYPE_USER, self::TEST_USER1)); |
| 205 | + $this->toTheFuture(3600); |
| 206 | + $deprecated = \OCP\Server::get(LockService::class)->getDeprecatedLocks(); |
| 207 | + self::assertNotEmpty($deprecated); |
| 208 | + } |
| 209 | + |
198 | 210 | public function testLockUserInfinite() {
|
199 | 211 | \OC::$server->getConfig()->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 0);
|
200 | 212 | $file = $this->loginAndGetUserFolder(self::TEST_USER1)
|
|
0 commit comments