Skip to content

Commit c052feb

Browse files
committed
add test for updating etag with unchanged mtime
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 3d0271a commit c052feb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/lib/Files/Cache/ScannerTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,4 +404,23 @@ public function dataTestIsPartialFile() {
404404
['/sub/folder/foo.txt', false],
405405
];
406406
}
407+
408+
public function testNoETagUnscannedFolder() {
409+
$this->fillTestFolders();
410+
411+
$this->scanner->scan('');
412+
413+
$oldFolderEntry = $this->cache->get('folder');
414+
// create a new file in a folder by keeping the mtime unchanged, but mark the folder as unscanned
415+
$this->storage->file_put_contents('folder/new.txt', 'foo');
416+
$this->storage->touch('folder', $oldFolderEntry->getMTime());
417+
$this->cache->update($oldFolderEntry->getId(), ['size' => -1]);
418+
419+
$this->scanner->scan('');
420+
421+
$this->cache->inCache('folder/new.txt');
422+
423+
$newFolderEntry = $this->cache->get('folder');
424+
$this->assertNotEquals($newFolderEntry->getEtag(), $oldFolderEntry->getEtag());
425+
}
407426
}

0 commit comments

Comments
 (0)