Skip to content

Commit c3c6a87

Browse files
committed
Change StorageUrlTrait::getStorageUrl() method to be public.
1 parent d54c811 commit c3c6a87

2 files changed

Lines changed: 5 additions & 15 deletions

File tree

solid/lib/Controller/GetStorageUrlTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final public function setUrlGenerator(IURLGenerator $urlGenerator): void
3030
* @FIXME: Add check for bob.nextcloud.local/solid/alice to throw 404
3131
* @TODO: Use route without `@alice` in /apps/solid/@alice/profile/card#me when user-domains are enabled
3232
*/
33-
protected function getStorageUrl($userId) {
33+
public function getStorageUrl($userId) {
3434
$routeUrl = $this->urlGenerator->linkToRoute(
3535
'solid.storage.handleHead',
3636
['userId' => $userId, 'path' => 'foo']

solid/tests/Unit/Controller/GetStorageUrlTraitTest.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ protected function setUp(): void
2727
{
2828
$this->trait = new class {
2929
use GetStorageUrlTrait;
30-
31-
public function _getStorageUrl($userId)
32-
{
33-
$class = new ReflectionObject($this);
34-
$method = $class->getMethod('getStorageUrl');
35-
// Only needed for PHP 8.1 and lower
36-
$method->setAccessible(true);
37-
38-
return $method->invokeArgs($this, [$userId]);
39-
}
4030
};
4131
}
4232

@@ -51,7 +41,7 @@ public function testGetStorageUrlWithoutUrlGenerator()
5141
$this->expectException(Error::class);
5242
$this->expectExceptionMessage('urlGenerator must not be accessed before initialization');
5343

54-
$this->trait->_getStorageUrl(self::MOCK_USER_ID);
44+
$this->trait->getStorageUrl(self::MOCK_USER_ID);
5545
}
5646

5747
/**
@@ -67,7 +57,7 @@ public function testGetStorageUrlWithoutConfig()
6757

6858
$this->trait->setUrlGenerator($mockUrlGenerator);
6959

70-
$this->trait->_getStorageUrl(self::MOCK_USER_ID);
60+
$this->trait->getStorageUrl(self::MOCK_USER_ID);
7161
}
7262

7363
/**
@@ -83,7 +73,7 @@ public function testGetStorageUrlWithUserSubDomainsDisabled($url, $userId, $expe
8373
$this->trait->setUrlGenerator($mockUrlGenerator);
8474
$this->trait->setConfig($mockConfig);
8575

86-
$actual = $this->trait->_getStorageUrl($userId);
76+
$actual = $this->trait->getStorageUrl($userId);
8777

8878
$this->assertEquals($expected, $actual);
8979
}
@@ -103,7 +93,7 @@ public function testGetStorageUrlWithUserSubDomainsEnabled($url, $userId, $expec
10393
$this->trait->setUrlGenerator($mockUrlGenerator);
10494
$this->trait->setConfig($mockConfig);
10595

106-
$actual = $this->trait->_getStorageUrl($userId);
96+
$actual = $this->trait->getStorageUrl($userId);
10797

10898
$this->assertEquals($expected, $actual);
10999
}

0 commit comments

Comments
 (0)