]> source.dussan.org Git - nextcloud-server.git/commitdiff
test disabling write check 33458/head
authorRobin Appelman <robin@icewind.nl>
Thu, 4 Aug 2022 10:32:46 +0000 (12:32 +0200)
committerJohn Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com>
Wed, 26 Oct 2022 18:45:59 +0000 (18:45 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php
tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php

index 5872056e42d25e0ceb4bfce97dc99765cf662f15..b85f6289c94858a3943ce41b5fa2fac7a2e27fe6 100644 (file)
@@ -37,4 +37,8 @@ class ObjectStoreStorageOverwrite extends ObjectStoreStorage {
        public function getObjectStore(): IObjectStore {
                return $this->objectStore;
        }
+
+       public function setValidateWrites(bool $validate) {
+               $this->validateWrites = $validate;
+       }
 }
index 5ebfd48d1a62b6a320e2b118fe8bdd38d76ab420..1bebaf6c4ba7bc93e8b4afefaf887b84aef69183 100644 (file)
@@ -181,6 +181,15 @@ class ObjectStoreStorageTest extends Storage {
                $this->assertFalse($this->instance->file_exists('test.txt'));
        }
 
+       public function testWriteObjectSilentFailureNoCheck() {
+               $objectStore = $this->instance->getObjectStore();
+               $this->instance->setObjectStore(new FailWriteObjectStore($objectStore));
+               $this->instance->setValidateWrites(false);
+
+               $this->instance->file_put_contents('test.txt', 'foo');
+               $this->assertTrue($this->instance->file_exists('test.txt'));
+       }
+
        public function testDeleteObjectFailureKeepCache() {
                $objectStore = $this->instance->getObjectStore();
                $this->instance->setObjectStore(new FailDeleteObjectStore($objectStore));