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 cd04615
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,15 @@ public function getStorage() {
}

/**
* @return string
* @return string|null
*/
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 @@ -209,11 +213,15 @@ public function getStorageId() {
}

/**
* @return int
* @return int|null
*/
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 cd04615

Please sign in to comment.