FailWriteObjectStore.php 997 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Files\ObjectStore;
  8. use OCP\Files\ObjectStore\IObjectStore;
  9. class FailWriteObjectStore implements IObjectStore {
  10. private $objectStore;
  11. public function __construct(IObjectStore $objectStore) {
  12. $this->objectStore = $objectStore;
  13. }
  14. public function getStorageId() {
  15. return $this->objectStore->getStorageId();
  16. }
  17. public function readObject($urn) {
  18. return $this->objectStore->readObject($urn);
  19. }
  20. public function writeObject($urn, $stream, ?string $mimetype = null) {
  21. // emulate a failed write that didn't throw an error
  22. return true;
  23. }
  24. public function deleteObject($urn) {
  25. $this->objectStore->deleteObject($urn);
  26. }
  27. public function objectExists($urn) {
  28. return $this->objectStore->objectExists($urn);
  29. }
  30. public function copyObject($from, $to) {
  31. $this->objectStore->copyObject($from, $to);
  32. }
  33. }