DeleteTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
  8. use OCP\AppFramework\Http;
  9. /**
  10. * Class DeleteTest
  11. *
  12. * @group DB
  13. *
  14. * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
  15. */
  16. class DeleteTest extends RequestTestCase {
  17. public function testBasicUpload(): void {
  18. $user = $this->getUniqueID();
  19. $view = $this->setupUser($user, 'pass');
  20. $view->file_put_contents('foo.txt', 'asd');
  21. $mount = $view->getMount('foo.txt');
  22. $internalPath = $view->getAbsolutePath();
  23. // create a ghost file
  24. $mount->getStorage()->unlink($mount->getInternalPath($internalPath));
  25. // cache entry still exists
  26. $this->assertInstanceOf('\OCP\Files\FileInfo', $view->getFileInfo('foo.txt'));
  27. $response = $this->request($view, $user, 'pass', 'DELETE', '/foo.txt');
  28. $this->assertEquals(Http::STATUS_NO_CONTENT, $response->getStatus());
  29. // no longer in the cache
  30. $this->assertFalse($view->getFileInfo('foo.txt'));
  31. }
  32. }