Update BlockLegacyClientPluginTest to reflect the new 403 error message.

Signed-off-by: Camila Ayres <hello@camilasan.com>
feature/minSupportDesktopVerMsg
Camila Ayres 3 months ago
parent 53e8c97de4
commit 7670c30ddc
No known key found for this signature in database
GPG Key ID: 7A4A6121E88E2AD4

@ -70,7 +70,7 @@ class BlockLegacyClientPlugin extends ServerPlugin {
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 <a href="'.$customClientDesktopLink.'">version '.$minimumSupportedDesktopVersion.' or later</a>.');
}
}
}

@ -64,7 +64,20 @@ class BlockLegacyClientPluginTest extends TestCase {
*/
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 <a href="https://nextcloud.com/install/#install-clients">version 1.7.0 or later</a>.');
/** @var RequestInterface|MockObject $request */
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
@ -74,11 +87,6 @@ class BlockLegacyClientPluginTest extends TestCase {
->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);
}

Loading…
Cancel
Save