]> source.dussan.org Git - nextcloud-server.git/commitdiff
tests: Add test for CacheEntry getters
authorFerdinand Thiessen <opensource@fthiessen.de>
Wed, 16 Aug 2023 11:48:31 +0000 (13:48 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Wed, 16 Aug 2023 12:00:21 +0000 (14:00 +0200)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
tests/lib/Files/Cache/CacheTest.php

index a5086a3eb3c656a1f2e6a670fb6c9c9f7ed1ca60..1b5c8e6e5ffcdbd42818917e6972bbaf1e817318 100644 (file)
@@ -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';