[Pkg-owncloud-commits] [owncloud] 11/62: Added storage backend test for checkUpdate

David Prévot taffit at moszumanska.debian.org
Tue Jun 23 23:39:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.5beta
in repository owncloud.

commit ae891537018a032f296a8eb2ad0fc8ccb9eddcbd
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Mon Apr 27 18:03:04 2015 +0200

    Added storage backend test for checkUpdate
    
    This helps testing whether checkUpdate properly returns false when no
    change exists
---
 tests/lib/files/storage/storage.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 30f403d..8209c40 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));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list