diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-06-07 09:34:16 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-06-07 09:34:16 +0200 |
commit | bf917d7063ed9328a8d367343ac2a6574917ddfb (patch) | |
tree | b15638a2971172e366f1d897007a863363251538 /apps/dav | |
parent | f28f6ad2df59b8faa9589bffbc9d2c53b03a2840 (diff) | |
parent | 3bd507325149185d2ac77d6b87aecbef3b8520e4 (diff) | |
download | nextcloud-server-bf917d7063ed9328a8d367343ac2a6574917ddfb.tar.gz nextcloud-server-bf917d7063ed9328a8d367343ac2a6574917ddfb.zip |
Merge pull request #24813 from owncloud/delete-ghost-files
allow deleting "ghost files" trough the View and Node api
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php new file mode 100644 index 00000000000..4f481cba557 --- /dev/null +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php @@ -0,0 +1,59 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest; + +use OC\Connector\Sabre\Exception\FileLocked; +use OCP\AppFramework\Http; +use OCP\Lock\ILockingProvider; + +/** + * Class DeleteTest + * + * @group DB + * + * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest + */ +class DeleteTest extends RequestTest { + public function testBasicUpload() { + $user = $this->getUniqueID(); + $view = $this->setupUser($user, 'pass'); + + $view->file_put_contents('foo.txt', 'asd'); + $mount = $view->getMount('foo.txt'); + $internalPath = $view->getAbsolutePath(); + + // create a ghost file + $mount->getStorage()->unlink($mount->getInternalPath($internalPath)); + + // cache entry still exists + $this->assertInstanceOf('\OCP\Files\FileInfo', $view->getFileInfo('foo.txt')); + + $response = $this->request($view, $user, 'pass', 'DELETE', '/foo.txt'); + + $this->assertEquals(Http::STATUS_NO_CONTENT, $response->getStatus()); + + // no longer in the cache + $this->assertFalse($view->getFileInfo('foo.txt')); + } +} |