diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-08-16 13:48:31 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-08-17 10:03:53 +0000 |
commit | b6b0c7e47a4f2dbb01644e254a948a3a7963ae3e (patch) | |
tree | 2308d2b621f48e35423de28697edd4f83c78aebc /tests/lib | |
parent | 3f81ebb5a221da54be7c3e839b7a76bb6042a1aa (diff) | |
download | nextcloud-server-b6b0c7e47a4f2dbb01644e254a948a3a7963ae3e.tar.gz nextcloud-server-b6b0c7e47a4f2dbb01644e254a948a3a7963ae3e.zip |
tests: Add test for CacheEntry getters
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Files/Cache/CacheTest.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index 7f8e1af1577..97be67e06f6 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -97,6 +97,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'; |