From eb105e7eb4820bff613722c1c16729eab40fde2d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 13 Mar 2020 11:11:00 +0100 Subject: [PATCH] Fix willReturnOnConsecutiveCalls Signed-off-by: Joas Schilling --- .../lib/Controller/ExternalSharesController.php | 1 + .../tests/Controller/ExternalShareControllerTest.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ExternalSharesController.php b/apps/files_sharing/lib/Controller/ExternalSharesController.php index f903871ffd6..122ad0f7cf4 100644 --- a/apps/files_sharing/lib/Controller/ExternalSharesController.php +++ b/apps/files_sharing/lib/Controller/ExternalSharesController.php @@ -133,6 +133,7 @@ class ExternalSharesController extends Controller { if (strpos($remote, '#') !== false || strpos($remote, '?') !== false) { return new DataResponse(false); } + if ( $this->testUrl('https://' . $remote . '/ocs-provider/') || $this->testUrl('https://' . $remote . '/ocs-provider/index.php') || diff --git a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php index 9ef508a3d0a..9d8ee9a9d42 100644 --- a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php @@ -99,8 +99,8 @@ class ExternalShareControllerTest extends \Test\TestCase { ->expects($this->exactly(2)) ->method('getBody') ->willReturnOnConsecutiveCalls( - ['Certainly not a JSON string'], - ['{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}'] + 'Certainly not a JSON string', + '{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}' ); $client ->expects($this->any()) @@ -124,7 +124,13 @@ class ExternalShareControllerTest extends \Test\TestCase { $response ->expects($this->exactly(5)) ->method('getBody') - ->will($this->onConsecutiveCalls('Certainly not a JSON string', 'Certainly not a JSON string', 'Certainly not a JSON string', 'Certainly not a JSON string', '{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}')); + ->willReturnOnConsecutiveCalls( + 'Certainly not a JSON string', + 'Certainly not a JSON string', + 'Certainly not a JSON string', + 'Certainly not a JSON string', + '{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}' + ); $this->clientService ->expects($this->exactly(5)) ->method('newClient') -- 2.39.5