diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2024-06-27 14:59:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 14:59:19 +0200 |
commit | 00aa8f543841c6bfd853a3ac5cb4ff3ab0a058ae (patch) | |
tree | b47151ce86cfd6c5ea2ea3313c6775406e4ad1ca /tests | |
parent | 1b49c864808dd95d069cf4ffe4c3fb1794aa8ca8 (diff) | |
parent | 280d70a5f42309b28df0baf675893abed2a391a2 (diff) | |
download | nextcloud-server-00aa8f543841c6bfd853a3ac5cb4ff3ab0a058ae.tar.gz nextcloud-server-00aa8f543841c6bfd853a3ac5cb4ff3ab0a058ae.zip |
Merge pull request #46133 from nextcloud/bugfix/noid/fix-missing-protocol-on-remotes
fix(federation): Fix missing protocol on CloudID remote
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Collaboration/Collaborators/RemotePluginTest.php | 5 | ||||
-rw-r--r-- | tests/lib/Federation/CloudIdManagerTest.php | 24 |
2 files changed, 13 insertions, 16 deletions
diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 39fdd3a2d22..73116ecad68 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -395,6 +395,11 @@ class RemotePluginTest extends TestCase { foreach ($protocols as $protocol) { $baseUrl = $user . '@' . $protocol . $remote; + if ($protocol === 'https://') { + // https:// protocol is not expected in the final result + $protocol = ''; + } + $testCases[] = [$baseUrl, $user, $protocol . $remote]; $testCases[] = [$baseUrl . '/', $user, $protocol . $remote]; $testCases[] = [$baseUrl . '/index.php', $user, $protocol . $remote]; diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php index 40477944019..13e6b111864 100644 --- a/tests/lib/Federation/CloudIdManagerTest.php +++ b/tests/lib/Federation/CloudIdManagerTest.php @@ -48,7 +48,7 @@ class CloudIdManagerTest extends TestCase { ); } - public function cloudIdProvider() { + public function cloudIdProvider(): array { return [ ['test@example.com', 'test', 'example.com', 'test@example.com'], ['test@example.com/cloud', 'test', 'example.com/cloud', 'test@example.com/cloud'], @@ -60,12 +60,8 @@ class CloudIdManagerTest extends TestCase { /** * @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 @@ class CloudIdManagerTest extends TestCase { $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:foo@example.com'], @@ -100,7 +96,7 @@ class CloudIdManagerTest extends TestCase { * @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 @@ class CloudIdManagerTest extends TestCase { public function getCloudIdProvider(): array { return [ - ['test', 'example.com', 'test@example.com'], + ['test', 'example.com', 'test@example.com', null, 'https://example.com', 'https://example.com'], ['test', 'http://example.com', 'test@http://example.com', 'test@example.com'], ['test', null, 'test@http://example.com', 'test@example.com', 'http://example.com', 'http://example.com'], - ['test@example.com', 'example.com', 'test@example.com@example.com'], + ['test@example.com', 'example.com', 'test@example.com@example.com', null, 'https://example.com', 'https://example.com'], ['test@example.com', 'https://example.com', 'test@example.com@example.com'], ['test@example.com', null, 'test@example.com@example.com', null, 'https://example.com', 'https://example.com'], ['test@example.com', 'https://example.com/index.php/s/shareToken', 'test@example.com@example.com', null, 'https://example.com', 'https://example.com'], @@ -123,10 +119,6 @@ class CloudIdManagerTest extends TestCase { /** * @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) { |