From 8f95d699540c71197b8fe1e1bcc40bcef25fd781 Mon Sep 17 00:00:00 2001
From: Lukas Reschke <lukas@owncloud.com>
Date: Mon, 29 Feb 2016 21:52:43 +0100
Subject: [PATCH] Fix tests

---
 .../controller/externalsharecontroller.php    | 34 ++++++++-----------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/apps/files_sharing/tests/controller/externalsharecontroller.php b/apps/files_sharing/tests/controller/externalsharecontroller.php
index ab5f1c153f3..bd20bffb36c 100644
--- a/apps/files_sharing/tests/controller/externalsharecontroller.php
+++ b/apps/files_sharing/tests/controller/externalsharecontroller.php
@@ -93,23 +93,17 @@ class ExternalShareControllerTest extends \Test\TestCase {
 			->disableOriginalConstructor()->getMock();
 		$response = $this->getMockBuilder('\\OCP\\Http\\Client\\IResponse')
 			->disableOriginalConstructor()->getMock();
-		$client
-			->expects($this->once())
-			->method('get')
-			->with(
-				'https://owncloud.org/status.php',
-				[
-					'timeout' => 3,
-					'connect_timeout' => 3,
-				]
-			)->will($this->returnValue($response));
 		$response
-			->expects($this->once())
+			->expects($this->exactly(2))
 			->method('getBody')
-			->will($this->returnValue('{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}'));
+			->will($this->onConsecutiveCalls('Certainly not a JSON string', '{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}'));
+		$client
+			->expects($this->any())
+			->method('get')
+			->will($this->returnValue($response));
 
 		$this->clientService
-			->expects($this->once())
+			->expects($this->exactly(2))
 			->method('newClient')
 			->will($this->returnValue($client));
 
@@ -123,13 +117,13 @@ class ExternalShareControllerTest extends \Test\TestCase {
 			->disableOriginalConstructor()->getMock();
 		$client
 			->method('get')
-			->will($this->onConsecutiveCalls($response, $response));
+			->will($this->returnValue($response));
 		$response
-			->expects($this->exactly(2))
+			->expects($this->exactly(5))
 			->method('getBody')
-			->will($this->onConsecutiveCalls('Certainly not a JSON string', '{"installed":true,"maintenance":false,"version":"8.1.0.8","versionstring":"8.1.0","edition":""}'));
+			->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":""}'));
 		$this->clientService
-			->expects($this->exactly(2))
+			->expects($this->exactly(5))
 			->method('newClient')
 			->will($this->returnValue($client));
 
@@ -143,13 +137,13 @@ class ExternalShareControllerTest extends \Test\TestCase {
 			->disableOriginalConstructor()->getMock();
 		$client
 			->method('get')
-			->will($this->onConsecutiveCalls($response, $response));
+			->will($this->returnValue($response));
 		$response
-			->expects($this->exactly(2))
+			->expects($this->exactly(6))
 			->method('getBody')
 			->will($this->returnValue('Certainly not a JSON string'));
 		$this->clientService
-			->expects($this->exactly(2))
+			->expects($this->exactly(6))
 			->method('newClient')
 			->will($this->returnValue($client));
 
-- 
GitLab