diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-02-13 14:30:05 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-02-13 14:30:05 +0100 |
commit | 134243d3e5a78b51f20ac0816d462c1de8e121c8 (patch) | |
tree | c30d8c09e9c930d7f102ba3759cbb79d5b23afaa /tests/lib/files/cache | |
parent | 139356396588e596de10d9816e4d26901d923b8b (diff) | |
download | nextcloud-server-134243d3e5a78b51f20ac0816d462c1de8e121c8.tar.gz nextcloud-server-134243d3e5a78b51f20ac0816d462c1de8e121c8.zip |
Dont lower the mtime of a folder when propagating changes
Diffstat (limited to 'tests/lib/files/cache')
-rw-r--r-- | tests/lib/files/cache/changepropagator.php | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/lib/files/cache/changepropagator.php b/tests/lib/files/cache/changepropagator.php index 89bd9dfe80a..1b56da5e97c 100644 --- a/tests/lib/files/cache/changepropagator.php +++ b/tests/lib/files/cache/changepropagator.php @@ -23,12 +23,17 @@ class ChangePropagator extends \Test\TestCase { */ private $view; + /** + * @var \OC\Files\Storage\Storage + */ + private $storage; + protected function setUp() { parent::setUp(); - $storage = new Temporary(array()); + $this->storage = new Temporary(array()); $root = $this->getUniqueID('/'); - Filesystem::mount($storage, array(), $root); + Filesystem::mount($this->storage, array(), $root); $this->view = new View($root); $this->propagator = new \OC\Files\Cache\ChangePropagator($this->view); } @@ -71,4 +76,22 @@ class ChangePropagator extends \Test\TestCase { $this->assertNotSame($oldInfo2->getEtag(), $newInfo2->getEtag()); $this->assertNotSame($oldInfo3->getEtag(), $newInfo3->getEtag()); } + + public function testDontLowerMtime() { + $time = time(); + $this->view->mkdir('/foo'); + $this->view->mkdir('/foo/bar'); + + $cache = $this->storage->getCache(); + $cache->put('', ['mtime' => $time - 50]); + $cache->put('foo', ['mtime' => $time - 150]); + $cache->put('foo/bar', ['mtime' => $time - 250]); + + $this->propagator->addChange('/foo/bar/foo'); + $this->propagator->propagateChanges($time - 100); + + $this->assertEquals(50, $time - $cache->get('')['mtime']); + $this->assertEquals(100, $time - $cache->get('foo')['mtime']); + $this->assertEquals(100, $time - $cache->get('foo/bar')['mtime']); + } } |