aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-08-16 13:48:31 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2023-08-16 14:00:21 +0200
commit5b37d6d9ff6bf6b99ba6dd25caab5a6ef5394598 (patch)
treeca91b24ce5cbfc67de64cc28ab809fafded55e72 /tests/lib/Files
parentf3fa006484c6dc7f3dd2504ea005dc3689ed4d44 (diff)
downloadnextcloud-server-5b37d6d9ff6bf6b99ba6dd25caab5a6ef5394598.tar.gz
nextcloud-server-5b37d6d9ff6bf6b99ba6dd25caab5a6ef5394598.zip
tests: Add test for CacheEntry getters
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'tests/lib/Files')
-rw-r--r--tests/lib/Files/Cache/CacheTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index a5086a3eb3c..1b5c8e6e5ff 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -98,6 +98,31 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($cacheData1, $this->cache->get($id1));
}
+ public function testCacheEntryGetters() {
+ $file1 = 'foo';
+ $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/file'];
+
+ $id1 = $this->cache->put($file1, $data1);
+ $entry = $this->cache->get($file1);
+
+ $this->assertEquals($entry->getId(), $id1);
+ $this->assertEquals($entry->getStorageId(), $this->cache->getNumericStorageId());
+ $this->assertEquals($entry->getPath(), 'foo');
+ $this->assertEquals($entry->getName(), 'foo');
+ $this->assertEquals($entry->getMimeType(), 'foo/file');
+ $this->assertEquals($entry->getMimePart(), 'foo');
+ $this->assertEquals($entry->getSize(), 100);
+ $this->assertEquals($entry->getMTime(), 50);
+ $this->assertEquals($entry->getStorageMTime(), 50);
+ $this->assertEquals($entry->getEtag(), null);
+ $this->assertEquals($entry->getPermissions(), 0);
+ $this->assertEquals($entry->isEncrypted(), false);
+ $this->assertEquals($entry->getMetadataEtag(), null);
+ $this->assertEquals($entry->getCreationTime(), null);
+ $this->assertEquals($entry->getUploadTime(), null);
+ $this->assertEquals($entry->getUnencryptedSize(), 100);
+ }
+
public function testPartial() {
$file1 = 'foo';