From 7670c30ddc368e896e589d4038f35d0763102639 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Fri, 9 Feb 2024 17:02:11 +0100 Subject: [PATCH] Update BlockLegacyClientPluginTest to reflect the new 403 error message. Signed-off-by: Camila Ayres --- .../Sabre/BlockLegacyClientPlugin.php | 2 +- .../Sabre/BlockLegacyClientPluginTest.php | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index dce6e78ff13a3..04a8d81773de1 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -70,7 +70,7 @@ public function beforeHandler(RequestInterface $request) { if (isset($versionMatches[1]) && version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { $customClientDesktopLink = $this->config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients'); - throw new \Sabre\DAV\Exception\Forbidden('This version of the client is unsupported. Upgrade to version '.$minimumSupportedDesktopVersion.' or later. Please open '.$customClientDesktopLink.' to download the update.'); + throw new \Sabre\DAV\Exception\Forbidden('This version of the client is unsupported. Upgrade to version '.$minimumSupportedDesktopVersion.' or later.'); } } } diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index cecd115710d7f..41233cb37607e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -64,7 +64,20 @@ public function oldDesktopClientProvider(): array { */ public function testBeforeHandlerException(string $userAgent): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); - $this->expectExceptionMessage('Unsupported client version.'); + + $this->config + ->expects($this->once()) + ->method('getSystemValue') + ->with('customclient_desktop', 'https://nextcloud.com/install/#install-clients') + ->willReturn('https://nextcloud.com/install/#install-clients'); + + $this->config + ->expects($this->once()) + ->method('getSystemValue') + ->with('minimum.supported.desktop.version', '2.3.0') + ->willReturn('1.7.0'); + + $this->expectExceptionMessage('This version of the client is unsupported. Upgrade to version 1.7.0 or later.'); /** @var RequestInterface|MockObject $request */ $request = $this->createMock('\Sabre\HTTP\RequestInterface'); @@ -74,11 +87,6 @@ public function testBeforeHandlerException(string $userAgent): void { ->with('User-Agent') ->willReturn($userAgent); - $this->config - ->expects($this->once()) - ->method('getSystemValue') - ->with('minimum.supported.desktop.version', '2.3.0') - ->willReturn('1.7.0'); $this->blockLegacyClientVersionPlugin->beforeHandler($request); }