Skip to content

Commit 5b37d6d

Browse files
committed
tests: Add test for CacheEntry getters
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent f3fa006 commit 5b37d6d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/lib/Files/Cache/CacheTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,31 @@ public function testSimple() {
9898
$this->assertEquals($cacheData1, $this->cache->get($id1));
9999
}
100100

101+
public function testCacheEntryGetters() {
102+
$file1 = 'foo';
103+
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/file'];
104+
105+
$id1 = $this->cache->put($file1, $data1);
106+
$entry = $this->cache->get($file1);
107+
108+
$this->assertEquals($entry->getId(), $id1);
109+
$this->assertEquals($entry->getStorageId(), $this->cache->getNumericStorageId());
110+
$this->assertEquals($entry->getPath(), 'foo');
111+
$this->assertEquals($entry->getName(), 'foo');
112+
$this->assertEquals($entry->getMimeType(), 'foo/file');
113+
$this->assertEquals($entry->getMimePart(), 'foo');
114+
$this->assertEquals($entry->getSize(), 100);
115+
$this->assertEquals($entry->getMTime(), 50);
116+
$this->assertEquals($entry->getStorageMTime(), 50);
117+
$this->assertEquals($entry->getEtag(), null);
118+
$this->assertEquals($entry->getPermissions(), 0);
119+
$this->assertEquals($entry->isEncrypted(), false);
120+
$this->assertEquals($entry->getMetadataEtag(), null);
121+
$this->assertEquals($entry->getCreationTime(), null);
122+
$this->assertEquals($entry->getUploadTime(), null);
123+
$this->assertEquals($entry->getUnencryptedSize(), 100);
124+
}
125+
101126
public function testPartial() {
102127
$file1 = 'foo';
103128

0 commit comments

Comments
 (0)