Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-04-19 18:01:34 +0300
committerRoeland Jago Douma <rullzer@owncloud.com>2016-04-20 20:09:26 +0300
commit2296552104a74d9f8841489d8d5e5dc691bb2a4d (patch)
treed6ab2b740963be79b0729bc99956e6aeb36b3a7b /tests
parent98647b8fe47c8719b2515c750cc1ca06b9b95d1d (diff)
When the scanner detects a file is changed clear checksum
Fixes #23782 and #23783 If the file scanner detects a changed file we clear the checksum while we update the cache. * Unit test added
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());
+ }
}