diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-10-24 15:26:53 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-10-24 17:45:32 +0200 |
commit | 43e498844e8c1aa519a19238d2cf3d6b95e1aab0 (patch) | |
tree | 59510ef2ffc6c1fd1fd92475013b108f1da2bfeb /apps/federatedfilesharing/tests | |
parent | b1f77aca4effec99387481a831910d4870ae2ffc (diff) | |
download | nextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.tar.gz nextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.zip |
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/federatedfilesharing/tests')
4 files changed, 26 insertions, 24 deletions
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 6d215d40156..a9c5cedf49b 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -47,9 +47,9 @@ class AddressHandlerTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->urlGenerator = $this->getMockBuilder('OCP\IURLGenerator') + $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class) ->getMock(); - $this->il10n = $this->getMockBuilder('OCP\IL10N') + $this->il10n = $this->getMockBuilder(IL10N::class) ->getMock(); $this->cloudIdManager = new CloudIdManager(); diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 7714ff4731c..b5ea08af8d5 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -35,6 +35,7 @@ use OCP\Federation\ICloudIdManager; use OCP\Files\IRootFolder; use OCP\Http\Client\IClientService; use OCP\IL10N; +use OCP\IRequest; use OCP\ISession; use OCP\IUserManager; use OCP\IUserSession; @@ -85,17 +86,17 @@ class MountPublicLinkControllerTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->request = $this->getMockBuilder('OCP\IRequest')->disableOriginalConstructor()->getMock(); + $this->request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock(); $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') ->disableOriginalConstructor()->getMock(); $this->shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock(); $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler') ->disableOriginalConstructor()->getMock(); $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder('OCP\IUserManager')->disableOriginalConstructor()->getMock(); + $this->userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock(); $this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager); $this->session = $this->getMockBuilder('OCP\ISession')->disableOriginalConstructor()->getMock(); - $this->l10n = $this->getMockBuilder('OCP\IL10N')->disableOriginalConstructor()->getMock(); + $this->l10n = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock(); $this->userSession = $this->getMockBuilder('OCP\IUserSession')->disableOriginalConstructor()->getMock(); $this->clientService = $this->getMockBuilder('OCP\Http\Client\IClientService')->disableOriginalConstructor()->getMock(); $this->cloudIdManager = new CloudIdManager(); diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index d57b2cb207f..538c6ae5a08 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -29,13 +29,13 @@ namespace OCA\FederatedFileSharing\Tests; use OC\Federation\CloudIdManager; use OC\Files\Filesystem; -use OCA\FederatedFileSharing\DiscoveryManager; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Controller\RequestHandlerController; use OCP\Federation\ICloudIdManager; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; +use OCP\IConfig; use OCP\IUserManager; use OCP\Share\IShare; @@ -83,9 +83,9 @@ class RequestHandlerControllerTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Share\Share::registerBackend('test', 'Test\Share\Backend'); - $config = $this->getMockBuilder('\OCP\IConfig') + $config = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor()->getMock(); - $clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService')->getMock(); + $clientService = $this->getMockBuilder(IClientService::class)->getMock(); $httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper') ->setConstructorArgs([$config, $clientService]) ->getMock(); @@ -104,7 +104,7 @@ class RequestHandlerControllerTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler') ->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock(); + $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); $this->cloudIdManager = new CloudIdManager(); diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 3ecd8162cad..aa81eef9e63 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -31,6 +31,7 @@ use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Notifications; use OCA\FederatedFileSharing\TokenHandler; use OCP\Federation\ICloudIdManager; +use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\IConfig; use OCP\IDBConnection; @@ -87,15 +88,15 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->tokenHandler = $this->getMockBuilder('OCA\FederatedFileSharing\TokenHandler') ->disableOriginalConstructor() ->getMock(); - $this->l = $this->getMockBuilder('OCP\IL10N')->getMock(); + $this->l = $this->getMockBuilder(IL10N::class)->getMock(); $this->l->method('t') ->will($this->returnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); })); - $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock(); + $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock(); - $this->config = $this->getMockBuilder('OCP\IConfig')->getMock(); - $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock(); + $this->config = $this->getMockBuilder(IConfig::class)->getMock(); + $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock(); //$this->addressHandler = new AddressHandler(\OC::$server->getURLGenerator(), $this->l); $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')->disableOriginalConstructor()->getMock(); $this->cloudIdManager = new CloudIdManager(); @@ -129,7 +130,7 @@ class FederatedShareProviderTest extends \Test\TestCase { public function testCreate() { $share = $this->shareManager->newShare(); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -200,7 +201,7 @@ class FederatedShareProviderTest extends \Test\TestCase { public function testCreateCouldNotFindServer() { $share = $this->shareManager->newShare(); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -256,7 +257,7 @@ class FederatedShareProviderTest extends \Test\TestCase { public function testCreateException() { $share = $this->shareManager->newShare(); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -312,7 +313,7 @@ class FederatedShareProviderTest extends \Test\TestCase { public function testCreateShareWithSelf() { $share = $this->shareManager->newShare(); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -351,7 +352,7 @@ class FederatedShareProviderTest extends \Test\TestCase { public function testCreateAlreadyShared() { $share = $this->shareManager->newShare(); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -419,7 +420,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $share = $this->shareManager->newShare(); - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -476,7 +477,7 @@ class FederatedShareProviderTest extends \Test\TestCase { } public function testGetSharedBy() { - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -517,7 +518,7 @@ class FederatedShareProviderTest extends \Test\TestCase { } public function testGetSharedByWithNode() { - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -536,7 +537,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setNode($node); $this->provider->create($share); - $node2 = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node2 = $this->getMockBuilder(File::class)->getMock(); $node2->method('getId')->willReturn(43); $node2->method('getName')->willReturn('myOtherFile'); @@ -555,7 +556,7 @@ class FederatedShareProviderTest extends \Test\TestCase { } public function testGetSharedByWithReshares() { - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -588,7 +589,7 @@ class FederatedShareProviderTest extends \Test\TestCase { } public function testGetSharedByWithLimit() { - $node = $this->getMockBuilder('\OCP\Files\File')->getMock(); + $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); |