Skip to content

Commit 1ae8129

Browse files
committed
test disabling write check
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent de5714a commit 1ae8129

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ public function setObjectStore(IObjectStore $objectStore) {
3737
public function getObjectStore(): IObjectStore {
3838
return $this->objectStore;
3939
}
40+
41+
public function setValidateWrites(bool $validate) {
42+
$this->validateWrites = $validate;
43+
}
4044
}

tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ public function testWriteObjectSilentFailure() {
181181
$this->assertFalse($this->instance->file_exists('test.txt'));
182182
}
183183

184+
public function testWriteObjectSilentFailureNoCheck() {
185+
$objectStore = $this->instance->getObjectStore();
186+
$this->instance->setObjectStore(new FailWriteObjectStore($objectStore));
187+
$this->instance->setValidateWrites(false);
188+
189+
$this->instance->file_put_contents('test.txt', 'foo');
190+
$this->assertTrue($this->instance->file_exists('test.txt'));
191+
}
192+
184193
public function testDeleteObjectFailureKeepCache() {
185194
$objectStore = $this->instance->getObjectStore();
186195
$this->instance->setObjectStore(new FailDeleteObjectStore($objectStore));

0 commit comments

Comments
 (0)