diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-02-18 07:17:27 -0800 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-02-18 07:17:27 -0800 |
commit | f554347db5271e3ae7e251369e5d73e7ab6cec93 (patch) | |
tree | 62ba9c098bce6b8abc7d4e410a649ace1a7d844e /tests/lib/files/cache/cache.php | |
parent | 0ab87204ec7568f26fc2f930e1004b3293b45676 (diff) | |
parent | 0c1ec758e89517acac8971f87e3c5796124e40ca (diff) | |
download | nextcloud-server-f554347db5271e3ae7e251369e5d73e7ab6cec93.tar.gz nextcloud-server-f554347db5271e3ae7e251369e5d73e7ab6cec93.zip |
Merge pull request #1724 from owncloud/long-storage-id
Cache: hash long storage ids to ensure they fit in the database
Diffstat (limited to 'tests/lib/files/cache/cache.php')
-rw-r--r-- | tests/lib/files/cache/cache.php | 15 |
1 files changed, 15 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(); } |