-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46133 from nextcloud/bugfix/noid/fix-missing-prot…
…ocol-on-remotes fix(federation): Fix missing protocol on CloudID remote
- Loading branch information
Showing
6 changed files
with
35 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ protected function setUp(): void { | |
); | ||
} | ||
|
||
public function cloudIdProvider() { | ||
public function cloudIdProvider(): array { | ||
return [ | ||
['[email protected]', 'test', 'example.com', '[email protected]'], | ||
['[email protected]/cloud', 'test', 'example.com/cloud', '[email protected]/cloud'], | ||
|
@@ -60,12 +60,8 @@ public function cloudIdProvider() { | |
|
||
/** | ||
* @dataProvider cloudIdProvider | ||
* | ||
* @param string $cloudId | ||
* @param string $user | ||
* @param string $remote | ||
*/ | ||
public function testResolveCloudId($cloudId, $user, $remote, $cleanId) { | ||
public function testResolveCloudId(string $cloudId, string $user, string $noProtocolRemote, string $cleanId): void { | ||
$displayName = 'Ample Ex'; | ||
|
||
$this->contactsManager->expects($this->any()) | ||
|
@@ -81,12 +77,12 @@ public function testResolveCloudId($cloudId, $user, $remote, $cleanId) { | |
$cloudId = $this->cloudIdManager->resolveCloudId($cloudId); | ||
|
||
$this->assertEquals($user, $cloudId->getUser()); | ||
$this->assertEquals($remote, $cloudId->getRemote()); | ||
$this->assertEquals('https://' . $noProtocolRemote, $cloudId->getRemote()); | ||
$this->assertEquals($cleanId, $cloudId->getId()); | ||
$this->assertEquals($displayName . '@' . $remote, $cloudId->getDisplayId()); | ||
$this->assertEquals($displayName . '@' . $noProtocolRemote, $cloudId->getDisplayId()); | ||
} | ||
|
||
public function invalidCloudIdProvider() { | ||
public function invalidCloudIdProvider(): array { | ||
return [ | ||
['example.com'], | ||
['test:[email protected]'], | ||
|
@@ -100,7 +96,7 @@ public function invalidCloudIdProvider() { | |
* @param string $cloudId | ||
* | ||
*/ | ||
public function testInvalidCloudId($cloudId) { | ||
public function testInvalidCloudId(string $cloudId): void { | ||
$this->expectException(\InvalidArgumentException::class); | ||
|
||
$this->contactsManager->expects($this->never()) | ||
|
@@ -111,10 +107,10 @@ public function testInvalidCloudId($cloudId) { | |
|
||
public function getCloudIdProvider(): array { | ||
return [ | ||
['test', 'example.com', '[email protected]'], | ||
['test', 'example.com', '[email protected]', null, 'https://example.com', 'https://example.com'], | ||
['test', 'http://example.com', 'test@http://example.com', '[email protected]'], | ||
['test', null, 'test@http://example.com', '[email protected]', 'http://example.com', 'http://example.com'], | ||
['[email protected]', 'example.com', '[email protected]@example.com'], | ||
['[email protected]', 'example.com', '[email protected]@example.com', null, 'https://example.com', 'https://example.com'], | ||
['[email protected]', 'https://example.com', '[email protected]@example.com'], | ||
['[email protected]', null, '[email protected]@example.com', null, 'https://example.com', 'https://example.com'], | ||
['[email protected]', 'https://example.com/index.php/s/shareToken', '[email protected]@example.com', null, 'https://example.com', 'https://example.com'], | ||
|
@@ -123,10 +119,6 @@ public function getCloudIdProvider(): array { | |
|
||
/** | ||
* @dataProvider getCloudIdProvider | ||
* | ||
* @param string $user | ||
* @param null|string $remote | ||
* @param string $id | ||
*/ | ||
public function testGetCloudId(string $user, ?string $remote, string $id, ?string $searchCloudId = null, ?string $localHost = 'https://example.com', ?string $expectedRemoteId = null): void { | ||
if ($remote !== null) { | ||
|