Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-02-20 13:55:20 +0400
committerThomas Mueller <thomas.mueller@tmit.eu>2013-02-20 13:55:20 +0400
commit5062ae250b767867609f64c29ab4cde65f022b75 (patch)
treeba624bec5f2470fbaadb4b281c57386210e5708e /tests
parent2675290325dc6a67f6719febe5ed0a546bd7a32a (diff)
parent38782036798dbe0a34995a3fca0aa92583cb9099 (diff)
Merge branch 'master' into master-sqlserver
Conflicts: lib/files/cache/cache.php
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/cache/cache.php15
-rw-r--r--tests/lib/files/mount.php17
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index c466fbb63e7..250842805e5 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -8,6 +8,12 @@
namespace Test\Files\Cache;
+class LongId extends \OC\Files\Storage\Temporary {
+ public function getId() {
+ return 'long:' . str_repeat('foo', 50) . parent::getId();
+ }
+}
+
class Cache extends \PHPUnit_Framework_TestCase {
/**
* @var \OC\Files\Storage\Temporary $storage;
@@ -204,6 +210,15 @@ class Cache extends \PHPUnit_Framework_TestCase {
$this->assertEquals(array($storageId, 'foo'), \OC\Files\Cache\Cache::getById($id));
}
+ function testLongId() {
+ $storage = new LongId(array());
+ $cache = $storage->getCache();
+ $storageId = $storage->getId();
+ $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');
+ $id = $cache->put('foo', $data);
+ $this->assertEquals(array(md5($storageId), 'foo'), \OC\Files\Cache\Cache::getById($id));
+ }
+
public function tearDown() {
$this->cache->clear();
}
diff --git a/tests/lib/files/mount.php b/tests/lib/files/mount.php
index f223f0f6c53..4e6aaf0679b 100644
--- a/tests/lib/files/mount.php
+++ b/tests/lib/files/mount.php
@@ -10,6 +10,12 @@ namespace Test\Files;
use \OC\Files\Storage\Temporary;
+class LongId extends Temporary {
+ public function getId() {
+ return 'long:' . str_repeat('foo', 50) . parent::getId();
+ }
+}
+
class Mount extends \PHPUnit_Framework_TestCase {
public function setup() {
\OC_Util::setupFS();
@@ -38,4 +44,15 @@ class Mount extends \PHPUnit_Framework_TestCase {
$mount2 = new \OC\Files\Mount($storage, '/foo/bar');
$this->assertEquals(array($mount, $mount2), \OC\Files\Mount::findById($id));
}
+
+ public function testLong() {
+ $storage = new LongId(array());
+ $mount = new \OC\Files\Mount($storage, '/foo');
+
+ $id = $mount->getStorageId();
+ $storageId = $storage->getId();
+ $this->assertEquals(array($mount), \OC\Files\Mount::findById($id));
+ $this->assertEquals(array($mount), \OC\Files\Mount::findById($storageId));
+ $this->assertEquals(array($mount), \OC\Files\Mount::findById(md5($storageId)));
+ }
}