]> source.dussan.org Git - nextcloud-server.git/commitdiff
add some tests for disabled updater
authorRobin Appelman <icewind@owncloud.com>
Fri, 27 Feb 2015 14:49:17 +0000 (15:49 +0100)
committerVincent Petry <pvince81@owncloud.com>
Fri, 27 Feb 2015 16:14:17 +0000 (17:14 +0100)
tests/lib/files/cache/updater.php

index 01b036de5d832c621d5cba51b41b5a4c47e730ca..970af2e68df50728049242c6d7353ec2ea6deec4 100644 (file)
@@ -146,4 +146,34 @@ class Updater extends \Test\TestCase {
                $this->assertEquals($cached['size'], $cachedTarget['size']);
                $this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
        }
+
+       public function testNewFileDisabled() {
+               $this->storage->file_put_contents('foo.txt', 'bar');
+               $this->assertFalse($this->cache->inCache('foo.txt'));
+
+               $this->updater->disable();
+               $this->updater->update('/foo.txt');
+
+               $this->assertFalse($this->cache->inCache('foo.txt'));
+       }
+
+       public function testMoveDisabled() {
+               $this->storage->file_put_contents('foo.txt', 'qwerty');
+               $this->updater->update('foo.txt');
+
+               $this->assertTrue($this->cache->inCache('foo.txt'));
+               $this->assertFalse($this->cache->inCache('bar.txt'));
+               $cached = $this->cache->get('foo.txt');
+
+               $this->storage->rename('foo.txt', 'bar.txt');
+
+               $this->assertTrue($this->cache->inCache('foo.txt'));
+               $this->assertFalse($this->cache->inCache('bar.txt'));
+
+               $this->updater->disable();
+               $this->updater->rename('foo.txt', 'bar.txt');
+
+               $this->assertTrue($this->cache->inCache('foo.txt'));
+               $this->assertFalse($this->cache->inCache('bar.txt'));
+       }
 }