From 4cee9cd11845a107b89c348e3df3664d2de3bc31 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 22 Nov 2023 12:27:30 +0545 Subject: [PATCH] tests: add tests for lock expiration --- .../features/apiLocks/lockFiles.feature | 19 +++++++++++++++++++ .../bootstrap/WebDavLockingContext.php | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/tests/acceptance/features/apiLocks/lockFiles.feature b/tests/acceptance/features/apiLocks/lockFiles.feature index db2ac997e18..e9d673fc6ca 100644 --- a/tests/acceptance/features/apiLocks/lockFiles.feature +++ b/tests/acceptance/features/apiLocks/lockFiles.feature @@ -367,3 +367,22 @@ Feature: lock files | new | exclusive | | spaces | shared | | spaces | exclusive | + + + Scenario Outline: lock expiration + Given using DAV path + And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile0.txt" + And user "Alice" has locked file "textfile0.txt" setting the following properties + | lockscope | | + | timeout | Second-5 | + When the user waits for "5" seconds to expire the lock + Then user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "textfile0.txt" + And 0 locks should be reported for file "textfile0.txt" of user "Alice" by the WebDAV API + Examples: + | dav-path-version | lock-scope | + | old | shared | + | old | exclusive | + | new | shared | + | new | exclusive | + | spaces | shared | + | spaces | exclusive | diff --git a/tests/acceptance/features/bootstrap/WebDavLockingContext.php b/tests/acceptance/features/bootstrap/WebDavLockingContext.php index 63851aec9db..70e756c857e 100644 --- a/tests/acceptance/features/bootstrap/WebDavLockingContext.php +++ b/tests/acceptance/features/bootstrap/WebDavLockingContext.php @@ -828,6 +828,17 @@ public function numberOfLockShouldBeReported(int $count, string $file, string $u ); } + /** + * @When the user waits for :time seconds to expire the lock + * + * @param int $time + * + * @return void + */ + public function waitForCertainSecondsToExpireTheLock(int $time): void { + \sleep($time); + } + /** * This will run before EVERY scenario. * It will set the properties for this object.