summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-02-29 21:52:43 +0100
committerLukas Reschke <lukas@owncloud.com>2016-03-01 07:01:52 +0100
commit8f95d699540c71197b8fe1e1bcc40bcef25fd781 (patch)
treef0c4164fa8535e45f1964bd34a46b9505a15f1de /apps/files_sharing/tests
parent74e47da883dcc14980c63268e58d27c2f1c7e5ac (diff)
downloadnextcloud-server-8f95d699540c71197b8fe1e1bcc40bcef25fd781.tar.gz
nextcloud-server-8f95d699540c71197b8fe1e1bcc40bcef25fd781.zip
Fix tests
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/controller/externalsharecontroller.php34
1 files 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));