CommonTest.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 OC\Files\Storage;
  8. class CommonTest extends \OC\Files\Storage\Common {
  9. /**
  10. * underlying local storage used for missing functions
  11. * @var \OC\Files\Storage\Local
  12. */
  13. private $storage;
  14. public function __construct(array $parameters) {
  15. $this->storage = new \OC\Files\Storage\Local($parameters);
  16. }
  17. public function getId(): string {
  18. return 'test::' . $this->storage->getId();
  19. }
  20. public function mkdir(string $path): bool {
  21. return $this->storage->mkdir($path);
  22. }
  23. public function rmdir(string $path): bool {
  24. return $this->storage->rmdir($path);
  25. }
  26. public function opendir(string $path) {
  27. return $this->storage->opendir($path);
  28. }
  29. public function stat(string $path): array|false {
  30. return $this->storage->stat($path);
  31. }
  32. public function filetype(string $path): string|false {
  33. return @$this->storage->filetype($path);
  34. }
  35. public function isReadable(string $path): bool {
  36. return $this->storage->isReadable($path);
  37. }
  38. public function isUpdatable(string $path): bool {
  39. return $this->storage->isUpdatable($path);
  40. }
  41. public function file_exists(string $path): bool {
  42. return $this->storage->file_exists($path);
  43. }
  44. public function unlink(string $path): bool {
  45. return $this->storage->unlink($path);
  46. }
  47. public function fopen(string $path, string $mode) {
  48. return $this->storage->fopen($path, $mode);
  49. }
  50. public function free_space(string $path): int|float|false {
  51. return $this->storage->free_space($path);
  52. }
  53. public function touch(string $path, ?int $mtime = null): bool {
  54. return $this->storage->touch($path, $mtime);
  55. }
  56. }