Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Feb 7, 2023
1 parent e3bafcc commit 7fd96c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ public function getStorage() {
*/
public function getStorageId() {
if (!$this->storageId) {
$this->storageId = $this->getStorage()->getId();
$storage = $this->getStorage();
if (is_null($storage)) {
return null;
}
$this->storageId = $storage->getId();
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
Expand All @@ -213,7 +217,11 @@ public function getStorageId() {
*/
public function getNumericStorageId() {
if (is_null($this->numericStorageId)) {
$this->numericStorageId = $this->getStorage()->getStorageCache()->getNumericId();
$storage = $this->getStorage();
if (is_null($storage)) {
return null;
}
$this->numericStorageId = $storage->getStorageCache()->getNumericId();
}
return $this->numericStorageId;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/Files/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,9 @@ private function createTestMovableMountPoints($mountPoints) {
->setConstructorArgs([[]])
->getMock();
$storage->method('getId')->willReturn('non-null-id');
$storage->method('getStorageCache')->willReturnCallback(function () use ($storage) {
return new \OC\Files\Cache\Storage($storage);
});

$mounts[] = $this->getMockBuilder(TestMoveableMountPoint::class)
->setMethods(['moveMount'])
Expand Down

0 comments on commit 7fd96c2

Please sign in to comment.