From 1c39b30d50ac70438bbb36e9318087c52a1f1c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 21 Oct 2016 13:29:19 +0200 Subject: [PATCH 1/3] Require to use at least desktop client 2.0 by default --- apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index 5d39d83a28..616816d349 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -68,7 +68,7 @@ class BlockLegacyClientPlugin extends ServerPlugin { return; } - $minimumSupportedDesktopVersion = $this->config->getSystemValue('minimum.supported.desktop.version', '1.7.0'); + $minimumSupportedDesktopVersion = $this->config->getSystemValue('minimum.supported.desktop.version', '2.0.0'); // Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or // "mirall/%1" for older releases From 9df3869bfc6a8ea998725d7b0af30a3230af2dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 24 Oct 2016 22:38:22 +0200 Subject: [PATCH 2/3] Fix unit tests for BlockLegacyClientPlugin --- .../Sabre/BlockLegacyClientPluginTest.php | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index 933460a630..eb1689089a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin; +use PHPUnit_Framework_MockObject_MockObject; use Test\TestCase; use OCP\IConfig; @@ -35,7 +36,7 @@ use OCP\IConfig; * @package OCA\DAV\Tests\unit\Connector\Sabre */ class BlockLegacyClientPluginTest extends TestCase { - /** @var IConfig */ + /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ private $config; /** @var BlockLegacyClientPlugin */ private $blockLegacyClientVersionPlugin; @@ -69,10 +70,8 @@ class BlockLegacyClientPluginTest extends TestCase { * @expectedExceptionMessage Unsupported client version. */ public function testBeforeHandlerException($userAgent) { - /** @var \Sabre\HTTP\RequestInterface $request */ - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') - ->disableOriginalConstructor() - ->getMock(); + /** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */ + $request = $this->createMock('\Sabre\HTTP\RequestInterface'); $request ->expects($this->once()) ->method('getHeader') @@ -82,7 +81,7 @@ class BlockLegacyClientPluginTest extends TestCase { $this->config ->expects($this->once()) ->method('getSystemValue') - ->with('minimum.supported.desktop.version', '1.7.0') + ->with('minimum.supported.desktop.version', '2.0.0') ->will($this->returnValue('1.7.0')); $this->blockLegacyClientVersionPlugin->beforeHandler($request); @@ -106,10 +105,8 @@ class BlockLegacyClientPluginTest extends TestCase { * @param string $userAgent */ public function testBeforeHandlerSuccess($userAgent) { - /** @var \Sabre\HTTP\RequestInterface $request */ - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') - ->disableOriginalConstructor() - ->getMock(); + /** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */ + $request = $this->createMock('\Sabre\HTTP\RequestInterface'); $request ->expects($this->once()) ->method('getHeader') @@ -119,17 +116,15 @@ class BlockLegacyClientPluginTest extends TestCase { $this->config ->expects($this->once()) ->method('getSystemValue') - ->with('minimum.supported.desktop.version', '1.7.0') + ->with('minimum.supported.desktop.version', '2.0.0') ->will($this->returnValue('1.7.0')); $this->blockLegacyClientVersionPlugin->beforeHandler($request); } public function testBeforeHandlerNoUserAgent() { - /** @var \Sabre\HTTP\RequestInterface $request */ - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') - ->disableOriginalConstructor() - ->getMock(); + /** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */ + $request = $this->createMock('\Sabre\HTTP\RequestInterface'); $request ->expects($this->once()) ->method('getHeader') From 1f90949e665a56617e5a783b51a84be3b17c1d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 24 Oct 2016 22:42:29 +0200 Subject: [PATCH 3/3] Set 2.0.0 as minimum requirement for the desktop client in config.sample.php --- config/config.sample.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index df1e2d16fc..7f4b334564 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1174,7 +1174,7 @@ $CONFIG = array( * client may not function as expected, and could lead to permanent data loss for * clients or other unexpected results. */ -'minimum.supported.desktop.version' => '1.7.0', +'minimum.supported.desktop.version' => '2.0.0', /** * EXPERIMENTAL: option whether to include external storage in quota