summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-01 11:27:07 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-01 11:27:07 +0100
commit73e145cf63e94f68dc1f129da14e470695d46abd (patch)
tree105561c3482a9ad9d52c68b80eff57d69d045ba6 /apps/files_sharing/tests
parent256dfd27b6129f9eba205bf4195246c0cac6045b (diff)
parent9ca1e9c7e941ee04a33bdf092739df367fe68356 (diff)
downloadnextcloud-server-73e145cf63e94f68dc1f129da14e470695d46abd.tar.gz
nextcloud-server-73e145cf63e94f68dc1f129da14e470695d46abd.zip
Merge pull request #22728 from owncloud/external-share-testremote
use ocs discover endpoint to test remote
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));