2016-06-03 14:35:42 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2016-07-21 19:13:36 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2016-06-03 14:35:42 +03:00
|
|
|
*
|
|
|
|
* @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,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2016-06-03 14:35:42 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
|
|
|
|
|
|
|
|
use OCP\AppFramework\Http;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class DeleteTest
|
|
|
|
*
|
|
|
|
* @group DB
|
|
|
|
*
|
|
|
|
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
|
|
|
|
*/
|
2017-04-27 10:49:37 +03:00
|
|
|
class DeleteTest extends RequestTestCase {
|
2016-06-03 14:35:42 +03:00
|
|
|
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'));
|
|
|
|
}
|
|
|
|
}
|