aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/connector/sabre
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-10-05 15:41:41 +0200
committerRobin Appelman <icewind@owncloud.com>2015-10-20 14:15:59 +0200
commit760335c57df3338325eee0b17cabc9b887f7a5a7 (patch)
treec9a509fe41036ffd37b092825ab8b2211a48f791 /apps/dav/tests/unit/connector/sabre
parentddc8749814a38b33881721a8f4eccfe15e13dacb (diff)
downloadnextcloud-server-760335c57df3338325eee0b17cabc9b887f7a5a7.tar.gz
nextcloud-server-760335c57df3338325eee0b17cabc9b887f7a5a7.zip
fix locking in tests
Diffstat (limited to 'apps/dav/tests/unit/connector/sabre')
-rw-r--r--apps/dav/tests/unit/connector/sabre/file.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/dav/tests/unit/connector/sabre/file.php b/apps/dav/tests/unit/connector/sabre/file.php
index 9171fc3b786..d874b7f33c2 100644
--- a/apps/dav/tests/unit/connector/sabre/file.php
+++ b/apps/dav/tests/unit/connector/sabre/file.php
@@ -200,7 +200,9 @@ class File extends \Test\TestCase {
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
// put first chunk
+ $file->acquireLock(ILockingProvider::LOCK_SHARED);
$this->assertNull($file->put('test data one'));
+ $file->releaseLock(ILockingProvider::LOCK_SHARED);
$info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-1', null, null, [
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -443,12 +445,12 @@ class File extends \Test\TestCase {
$thrown = false;
try {
// beforeMethod locks
- $view->lockFile('/test.txt', ILockingProvider::LOCK_SHARED);
+ $file->acquireLock(ILockingProvider::LOCK_SHARED);
$file->put($this->getStream('test data'));
// afterMethod unlocks
- $view->unlockFile('/test.txt', ILockingProvider::LOCK_SHARED);
+ $file->releaseLock(ILockingProvider::LOCK_SHARED);
} catch (\Sabre\DAV\Exception\BadRequest $e) {
$thrown = true;
}
@@ -505,7 +507,9 @@ class File extends \Test\TestCase {
'permissions' => \OCP\Constants::PERMISSION_ALL
], null);
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file->acquireLock(ILockingProvider::LOCK_SHARED);
$this->assertNull($file->put('test data one'));
+ $file->releaseLock(ILockingProvider::LOCK_SHARED);
$info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-1', null, null, [
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -515,7 +519,9 @@ class File extends \Test\TestCase {
// action
$thrown = false;
try {
+ $file->acquireLock(ILockingProvider::LOCK_SHARED);
$file->put($this->getStream('test data'));
+ $file->releaseLock(ILockingProvider::LOCK_SHARED);
} catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) {
$thrown = true;
}