}
/**
- * @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);
}
*/
public function getNumericStorageId() {
if (is_null($this->numericStorageId)) {
- $this->numericStorageId = $this->getStorage()->getStorageCache()->getNumericId();
+ $storage = $this->getStorage();
+ if (is_null($storage)) {
+ return -1;
+ }
+ $this->numericStorageId = $storage->getStorageCache()->getNumericId();
}
return $this->numericStorageId;
}
/**
* Get the id of the storages
*
- * @return string
+ * @return string|null
* @since 8.0.0
*/
public function getStorageId();
/**
* Get the id of the storages
*
- * @return int
+ * @return int|null
* @since 9.1.0
*/
public function getNumericStorageId();
->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'])