aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-09-29 00:48:31 +0200
committerGitHub <noreply@github.com>2016-09-29 00:48:31 +0200
commit6f831670bfa184ad2940d7cca40ef2663a7cca25 (patch)
tree221a1a3b912b49696742adbcb71e56e43f2047a0 /apps
parent2eab2ffa22451851601d68bd73e0285a8803990e (diff)
parentbd70221d61b7467e2ab3eaf20243f114c0787989 (diff)
downloadnextcloud-server-6f831670bfa184ad2940d7cca40ef2663a7cca25.tar.gz
nextcloud-server-6f831670bfa184ad2940d7cca40ef2663a7cca25.zip
Merge pull request #1565 from nextcloud/mock-http-service
Mock HTTPClientService
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
index 8e1000fb500..18d698d398e 100644
--- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
@@ -31,6 +31,9 @@ use OC\Files\Filesystem;
use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Controller\RequestHandlerController;
+use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
+use OCP\Http\Client\IResponse;
use OCP\IUserManager;
use OCP\Share\IShare;
@@ -242,15 +245,31 @@ class RequestHandlerControllerTest extends TestCase {
function testDeleteUser($toDelete, $expected, $remainingUsers) {
$this->createDummyS2SShares();
+ $httpClientService = $this->createMock(IClientService::class);
+ $client = $this->createMock(IClient::class);
+ $response = $this->createMock(IResponse::class);
+ $client
+ ->expects($this->any())
+ ->method('get')
+ ->willReturn($response);
+ $client
+ ->expects($this->any())
+ ->method('post')
+ ->willReturn($response);
+ $httpClientService
+ ->expects($this->any())
+ ->method('newClient')
+ ->willReturn($client);
+
$discoveryManager = new DiscoveryManager(
\OC::$server->getMemCacheFactory(),
- \OC::$server->getHTTPClientService()
+ $httpClientService
);
$manager = new \OCA\Files_Sharing\External\Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
- \OC::$server->getHTTPClientService(),
+ $httpClientService,
\OC::$server->getNotificationManager(),
$discoveryManager,
$toDelete