summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/tests/NotificationsTest.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-06-12 16:00:43 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2018-07-02 11:29:30 +0200
commit2e19213695d8bf9bc55eb57f4db9c7f04e8cc6fe (patch)
treef0910b77cb124748ec73aa99c94a4710bdd2da29 /apps/federatedfilesharing/tests/NotificationsTest.php
parent9d145bb5dd488beee1e04044f201863ee005a73e (diff)
downloadnextcloud-server-2e19213695d8bf9bc55eb57f4db9c7f04e8cc6fe.tar.gz
nextcloud-server-2e19213695d8bf9bc55eb57f4db9c7f04e8cc6fe.zip
fix notification tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/federatedfilesharing/tests/NotificationsTest.php')
-rw-r--r--apps/federatedfilesharing/tests/NotificationsTest.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php
index c2ad1b2030d..4c491ba2f9a 100644
--- a/apps/federatedfilesharing/tests/NotificationsTest.php
+++ b/apps/federatedfilesharing/tests/NotificationsTest.php
@@ -29,6 +29,8 @@ namespace OCA\FederatedFileSharing\Tests;
use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\Notifications;
use OCP\BackgroundJob\IJobList;
+use OCP\Federation\ICloudFederationFactory;
+use OCP\Federation\ICloudFederationProviderManager;
use OCP\Http\Client\IClientService;
use OCP\OCS\IDiscoveryService;
@@ -46,6 +48,12 @@ class NotificationsTest extends \Test\TestCase {
/** @var IJobList | \PHPUnit_Framework_MockObject_MockObject */
private $jobList;
+ /** @var ICloudFederationProviderManager|\PHPUnit_Framework_MockObject_MockObject */
+ private $cloudFederationProviderManager;
+
+ /** @var ICloudFederationFactory|\PHPUnit_Framework_MockObject_MockObject */
+ private $cloudFederationFactory;
+
public function setUp() {
parent::setUp();
@@ -54,6 +62,8 @@ class NotificationsTest extends \Test\TestCase {
$this->httpClientService = $this->getMockBuilder('OCP\Http\Client\IClientService')->getMock();
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
->disableOriginalConstructor()->getMock();
+ $this->cloudFederationProviderManager = $this->createMock(ICloudFederationProviderManager::class);
+ $this->cloudFederationFactory = $this->createMock(ICloudFederationFactory::class);
}
@@ -69,7 +79,9 @@ class NotificationsTest extends \Test\TestCase {
$this->addressHandler,
$this->httpClientService,
$this->discoveryService,
- $this->jobList
+ $this->jobList,
+ $this->cloudFederationProviderManager,
+ $this->cloudFederationFactory
);
} else {
$instance = $this->getMockBuilder('OCA\FederatedFileSharing\Notifications')
@@ -78,7 +90,9 @@ class NotificationsTest extends \Test\TestCase {
$this->addressHandler,
$this->httpClientService,
$this->discoveryService,
- $this->jobList
+ $this->jobList,
+ $this->cloudFederationProviderManager,
+ $this->cloudFederationFactory
]
)->setMethods($mockedMethods)->getMock();
}
@@ -99,12 +113,13 @@ class NotificationsTest extends \Test\TestCase {
$id = 42;
$timestamp = 63576;
$token = 'token';
+ $action = 'unshare';
$instance = $this->getInstance(['tryHttpPostToShareEndpoint', 'getTimestamp']);
$instance->expects($this->any())->method('getTimestamp')->willReturn($timestamp);
$instance->expects($this->once())->method('tryHttpPostToShareEndpoint')
- ->with($remote, '/'.$id.'/unshare', ['token' => $token, 'data1Key' => 'data1Value'])
+ ->with($remote, '/'.$id.'/unshare', ['token' => $token, 'data1Key' => 'data1Value', 'remoteId' => $id], $action)
->willReturn($httpRequestResult);
// only add background job on first try
@@ -127,7 +142,7 @@ class NotificationsTest extends \Test\TestCase {
}
$this->assertSame($expected,
- $instance->sendUpdateToRemote($remote, $id, $token, 'unshare', ['data1Key' => 'data1Value'], $try)
+ $instance->sendUpdateToRemote($remote, $id, $token, $action, ['data1Key' => 'data1Value'], $try)
);
}