summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-20 20:37:01 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-20 20:37:01 +0200
commitcdcabbd0b3f6209b2a312b30a84c381f125bcf68 (patch)
treeb7542987656a5d91f785f4a0570fb3c07ace9df5 /tests
parent01b09b4f92f7a73873875b29ad11d39415adfa77 (diff)
parent0dbcbc4cae2eb669fc73f60a761855a907469111 (diff)
downloadnextcloud-server-cdcabbd0b3f6209b2a312b30a84c381f125bcf68.tar.gz
nextcloud-server-cdcabbd0b3f6209b2a312b30a84c381f125bcf68.zip
Merge pull request #24098 from owncloud/fix_23782
When calling file_put_contents clear the checksum
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 3e88a5306f8..86413c61aa1 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -2424,4 +2424,24 @@ class View extends \Test\TestCase {
$this->assertEquals($expected, $files);
}
+
+ public function testFilePutContentsClearsChecksum() {
+ $storage = new Temporary(array());
+ $scanner = $storage->getScanner();
+ $storage->file_put_contents('foo.txt', 'bar');
+ \OC\Files\Filesystem::mount($storage, array(), '/test/');
+ $scanner->scan('');
+
+ $view = new \OC\Files\View('/test/foo.txt');
+ $view->putFileInfo('.', ['checksum' => '42']);
+
+ $this->assertEquals('bar', $view->file_get_contents(''));
+ $fh = tmpfile();
+ fwrite($fh, 'fooo');
+ rewind($fh);
+ $view->file_put_contents('', $fh);
+ $this->assertEquals('fooo', $view->file_get_contents(''));
+ $data = $view->getFileInfo('.');
+ $this->assertEquals('', $data->getChecksum());
+ }
}