summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-31 14:06:51 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-31 14:06:51 +0200
commitac2be923a621b5ce194d0c347a1d405646599a19 (patch)
treed487373c64a79a5d9311bbd34ca0ef4867882e1a
parente4311a2ebdf3eeda8b2f1022c19290dc68db8ae5 (diff)
downloadnextcloud-server-ac2be923a621b5ce194d0c347a1d405646599a19.tar.gz
nextcloud-server-ac2be923a621b5ce194d0c347a1d405646599a19.zip
Fix deprecated usages of getMock in federatedfilesharing
-rw-r--r--apps/federatedfilesharing/tests/AddressHandlerTest.php6
-rw-r--r--apps/federatedfilesharing/tests/DiscoveryManagerTest.php18
-rw-r--r--apps/federatedfilesharing/tests/FederatedShareProviderTest.php32
-rw-r--r--apps/federatedfilesharing/tests/NotificationsTest.php4
-rw-r--r--apps/federatedfilesharing/tests/TokenHandlerTest.php2
5 files changed, 35 insertions, 27 deletions
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php
index 9ae37bb251d..c2e69fb2bd7 100644
--- a/apps/federatedfilesharing/tests/AddressHandlerTest.php
+++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php
@@ -43,8 +43,10 @@ class AddressHandlerTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->urlGenerator = $this->getMock('OCP\IURLGenerator');
- $this->il10n = $this->getMock('OCP\IL10N');
+ $this->urlGenerator = $this->getMockBuilder('OCP\IURLGenerator')
+ ->getMock();
+ $this->il10n = $this->getMockBuilder('OCP\IL10N')
+ ->getMock();
$this->addressHandler = new AddressHandler($this->urlGenerator, $this->il10n);
}
diff --git a/apps/federatedfilesharing/tests/DiscoveryManagerTest.php b/apps/federatedfilesharing/tests/DiscoveryManagerTest.php
index ec79a16a3aa..77e24aad54b 100644
--- a/apps/federatedfilesharing/tests/DiscoveryManagerTest.php
+++ b/apps/federatedfilesharing/tests/DiscoveryManagerTest.php
@@ -40,7 +40,8 @@ class DiscoveryManagerTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->cache = $this->getMock('\OCP\ICache');
+ $this->cache = $this->getMockBuilder('\OCP\ICache')
+ ->getMock();
/** @var ICacheFactory $cacheFactory */
$cacheFactory = $this->getMockBuilder('\OCP\ICacheFactory')
->disableOriginalConstructor()->getMock();
@@ -67,7 +68,8 @@ class DiscoveryManagerTest extends \Test\TestCase {
}
public function testWithMalformedFormattedEndpointCached() {
- $response = $this->getMock('\OCP\Http\Client\IResponse');
+ $response = $this->getMockBuilder('\OCP\Http\Client\IResponse')
+ ->getMock();
$response
->expects($this->once())
->method('getStatusCode')
@@ -104,7 +106,8 @@ class DiscoveryManagerTest extends \Test\TestCase {
}
public function testGetWebDavEndpointWithValidFormattedEndpointAndNotCached() {
- $response = $this->getMock('\OCP\Http\Client\IResponse');
+ $response = $this->getMockBuilder('\OCP\Http\Client\IResponse')
+ ->getMock();
$response
->expects($this->once())
->method('getStatusCode')
@@ -127,7 +130,8 @@ class DiscoveryManagerTest extends \Test\TestCase {
}
public function testGetWebDavEndpointWithValidFormattedEndpointWithoutDataAndNotCached() {
- $response = $this->getMock('\OCP\Http\Client\IResponse');
+ $response = $this->getMockBuilder('\OCP\Http\Client\IResponse')
+ ->getMock();
$response
->expects($this->once())
->method('getStatusCode')
@@ -150,7 +154,8 @@ class DiscoveryManagerTest extends \Test\TestCase {
}
public function testGetShareEndpointWithValidFormattedEndpointAndNotCached() {
- $response = $this->getMock('\OCP\Http\Client\IResponse');
+ $response = $this->getMockBuilder('\OCP\Http\Client\IResponse')
+ ->getMock();
$response
->expects($this->once())
->method('getStatusCode')
@@ -173,7 +178,8 @@ class DiscoveryManagerTest extends \Test\TestCase {
}
public function testWithMaliciousEndpointCached() {
- $response = $this->getMock('\OCP\Http\Client\IResponse');
+ $response = $this->getMockBuilder('\OCP\Http\Client\IResponse')
+ ->getMock();
$response
->expects($this->once())
->method('getStatusCode')
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
index d1a15158afa..e4c234fd038 100644
--- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
+++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
@@ -80,15 +80,15 @@ class FederatedShareProviderTest extends \Test\TestCase {
$this->tokenHandler = $this->getMockBuilder('OCA\FederatedFileSharing\TokenHandler')
->disableOriginalConstructor()
->getMock();
- $this->l = $this->getMock('OCP\IL10N');
+ $this->l = $this->getMockBuilder('OCP\IL10N')->getMock();
$this->l->method('t')
->will($this->returnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
- $this->logger = $this->getMock('OCP\ILogger');
- $this->rootFolder = $this->getMock('OCP\Files\IRootFolder');
- $this->config = $this->getMock('OCP\IConfig');
- $this->userManager = $this->getMock('OCP\IUserManager');
+ $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock();
+ $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
+ $this->config = $this->getMockBuilder('OCP\IConfig')->getMock();
+ $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock();
//$this->addressHandler = new AddressHandler(\OC::$server->getURLGenerator(), $this->l);
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')->disableOriginalConstructor()->getMock();
@@ -118,7 +118,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreate() {
$share = $this->shareManager->newShare();
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -189,7 +189,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateCouldNotFindServer() {
$share = $this->shareManager->newShare();
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -245,7 +245,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateException() {
$share = $this->shareManager->newShare();
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -301,7 +301,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateShareWithSelf() {
$share = $this->shareManager->newShare();
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -340,7 +340,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateAlreadyShared() {
$share = $this->shareManager->newShare();
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -406,7 +406,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$share = $this->shareManager->newShare();
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -463,7 +463,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedBy() {
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -504,7 +504,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedByWithNode() {
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -523,7 +523,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
->setNode($node);
$this->provider->create($share);
- $node2 = $this->getMock('\OCP\Files\File');
+ $node2 = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node2->method('getId')->willReturn(43);
$node2->method('getName')->willReturn('myOtherFile');
@@ -542,7 +542,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedByWithReshares() {
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -575,7 +575,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedByWithLimit() {
- $node = $this->getMock('\OCP\Files\File');
+ $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php
index 415afbd750c..dbcb1ef4e87 100644
--- a/apps/federatedfilesharing/tests/NotificationsTest.php
+++ b/apps/federatedfilesharing/tests/NotificationsTest.php
@@ -47,10 +47,10 @@ class NotificationsTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
+ $this->jobList = $this->getMockBuilder('OCP\BackgroundJob\IJobList')->getMock();
$this->discoveryManager = $this->getMockBuilder('OCA\FederatedFileSharing\DiscoveryManager')
->disableOriginalConstructor()->getMock();
- $this->httpClientService = $this->getMock('OCP\Http\Client\IClientService');
+ $this->httpClientService = $this->getMockBuilder('OCP\Http\Client\IClientService')->getMock();
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
->disableOriginalConstructor()->getMock();
diff --git a/apps/federatedfilesharing/tests/TokenHandlerTest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php
index e6fc470b553..10e5fc5df51 100644
--- a/apps/federatedfilesharing/tests/TokenHandlerTest.php
+++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php
@@ -42,7 +42,7 @@ class TokenHandlerTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->secureRandom = $this->getMock('OCP\Security\ISecureRandom');
+ $this->secureRandom = $this->getMockBuilder('OCP\Security\ISecureRandom')->getMock();
$this->tokenHandler = new TokenHandler($this->secureRandom);
}