aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-04-27 18:03:04 +0200
committerVincent Petry <pvince81@owncloud.com>2015-06-03 17:24:36 +0200
commitae891537018a032f296a8eb2ad0fc8ccb9eddcbd (patch)
tree491c63ba4bd7b4112b14171285a2e2cd4ee852e9
parent533bb85a858904b433403ecfd2396b13403274c0 (diff)
downloadnextcloud-server-ae891537018a032f296a8eb2ad0fc8ccb9eddcbd.tar.gz
nextcloud-server-ae891537018a032f296a8eb2ad0fc8ccb9eddcbd.zip
Added storage backend test for checkUpdate
This helps testing whether checkUpdate properly returns false when no change exists
-rw-r--r--tests/lib/files/storage/storage.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 30f403d60df..8209c40b757 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -22,6 +22,8 @@
namespace Test\Files\Storage;
+use OC\Files\Cache\Watcher;
+
abstract class Storage extends \Test\TestCase {
/**
* @var \OC\Files\Storage\Storage instance
@@ -307,6 +309,19 @@ abstract class Storage extends \Test\TestCase {
$this->assertTrue($this->instance->hasUpdated('/', $mtimeStart - 5));
}
+ /**
+ * Test whether checkUpdate properly returns false when there was
+ * no change.
+ */
+ public function testCheckUpdate() {
+ $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
+ $watcher = $this->instance->getWatcher();
+ $watcher->setPolicy(Watcher::CHECK_ALWAYS);
+ $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
+ $this->assertTrue($watcher->checkUpdate('/lorem.txt'), 'Update detected');
+ $this->assertFalse($watcher->checkUpdate('/lorem.txt'), 'No update');
+ }
+
public function testUnlink() {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));