diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-09-02 10:37:20 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-09-06 09:29:27 +0200 |
commit | d13ac20bca932fdcccb1f88f68b35d61aa6871a9 (patch) | |
tree | 3d0bdf66575226d8a7caa8270894cc2b40282bbb /apps/files_external/tests/Service | |
parent | 0c154c1ed779ccd68ea67e3528fad36ad6ac9b34 (diff) | |
download | nextcloud-server-d13ac20bca932fdcccb1f88f68b35d61aa6871a9.tar.gz nextcloud-server-d13ac20bca932fdcccb1f88f68b35d61aa6871a9.zip |
Fix getMock files_external
Diffstat (limited to 'apps/files_external/tests/Service')
4 files changed, 20 insertions, 11 deletions
diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php index efc0a32af5a..cbb25579e11 100644 --- a/apps/files_external/tests/Service/BackendServiceTest.php +++ b/apps/files_external/tests/Service/BackendServiceTest.php @@ -21,7 +21,11 @@ */ namespace OCA\Files_External\Tests\Service; +use OCA\Files_External\Lib\Config\IAuthMechanismProvider; +use OCA\Files_External\Lib\Config\IBackendProvider; use \OCA\Files_External\Service\BackendService; +use OCP\IConfig; +use OCP\IL10N; class BackendServiceTest extends \Test\TestCase { @@ -32,8 +36,8 @@ class BackendServiceTest extends \Test\TestCase { protected $l10n; protected function setUp() { - $this->config = $this->getMock('\OCP\IConfig'); - $this->l10n = $this->getMock('\OCP\IL10N'); + $this->config = $this->createMock(IConfig::class); + $this->l10n = $this->createMock(IL10N::class); } /** @@ -97,7 +101,7 @@ class BackendServiceTest extends \Test\TestCase { $backend1 = $this->getBackendMock('\Foo\Bar'); $backend2 = $this->getBackendMock('\Bar\Foo'); - $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider'); + $providerMock = $this->createMock(IBackendProvider::class); $providerMock->expects($this->once()) ->method('getBackends') ->willReturn([$backend1, $backend2]); @@ -115,7 +119,7 @@ class BackendServiceTest extends \Test\TestCase { $backend1 = $this->getAuthMechanismMock('\Foo\Bar'); $backend2 = $this->getAuthMechanismMock('\Bar\Foo'); - $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IAuthMechanismProvider'); + $providerMock = $this->createMock(IAuthMechanismProvider::class); $providerMock->expects($this->once()) ->method('getAuthMechanisms') ->willReturn([$backend1, $backend2]); @@ -135,12 +139,12 @@ class BackendServiceTest extends \Test\TestCase { $backend2 = $this->getBackendMock('\Dead\Beef'); - $provider1Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider'); + $provider1Mock = $this->createMock(IBackendProvider::class); $provider1Mock->expects($this->once()) ->method('getBackends') ->willReturn([$backend1a, $backend1b]); $service->registerBackendProvider($provider1Mock); - $provider2Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider'); + $provider2Mock = $this->createMock(IBackendProvider::class); $provider2Mock->expects($this->once()) ->method('getBackends') ->willReturn([$backend2]); diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index 5dcd93c8ae0..2776f24d5ab 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -31,6 +31,8 @@ use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\Service\BackendService; use OCA\Files_External\Service\DBConfigService; use OCA\Files_External\Service\StoragesService; +use OCP\AppFramework\IAppContainer; +use OCP\Files\Config\IUserMountCache; class CleaningDBConfig extends DBConfigService { private $mountIds = []; @@ -94,7 +96,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { ); \OC_Mount_Config::$skipTest = true; - $this->mountCache = $this->getMock('OCP\Files\Config\IUserMountCache'); + $this->mountCache = $this->createMock(IUserMountCache::class); // prepare BackendService mock $this->backendService = @@ -150,7 +152,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { Filesystem::signal_delete_mount, get_class($this), 'deleteHookCallback'); - $containerMock = $this->getMock('\OCP\AppFramework\IAppContainer'); + $containerMock = $this->createMock(IAppContainer::class); $containerMock->method('query') ->will($this->returnCallback(function ($name) { if ($name === 'OCA\Files_External\Service\BackendService') { diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index 6d4aa922c72..72e5dc15147 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -28,7 +28,9 @@ use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\NotFoundException; use OCA\Files_External\Service\StoragesService; use OCA\Files_External\Service\UserGlobalStoragesService; +use OCP\IGroupManager; use OCP\IUser; +use OCP\IUserSession; use Test\Traits\UserTrait; /** @@ -63,13 +65,13 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { $this->user = new \OC\User\User(self::USER_ID, null); /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSession */ - $userSession = $this->getMock('\OCP\IUserSession'); + $userSession = $this->createMock(IUserSession::class); $userSession ->expects($this->any()) ->method('getUser') ->will($this->returnValue($this->user)); - $this->groupManager = $this->getMock('\OCP\IGroupManager'); + $this->groupManager = $this->createMock(IGroupManager::class); $this->groupManager->method('isInGroup') ->will($this->returnCallback(function ($userId, $groupId) { if ($userId === self::USER_ID) { diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php index 85338065c73..3a820f644b4 100644 --- a/apps/files_external/tests/Service/UserStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php @@ -30,6 +30,7 @@ use OCA\Files_External\Service\GlobalStoragesService; use OCA\Files_External\Service\StoragesService; use OCA\Files_External\Service\UserStoragesService; use OCA\Files_External\Lib\StorageConfig; +use OCP\IUserSession; use Test\Traits\UserTrait; /** @@ -57,7 +58,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { $this->user = \OC::$server->getUserManager()->get($this->userId); /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSession */ - $userSession = $this->getMock('\OCP\IUserSession'); + $userSession = $this->createMock(IUserSession::class); $userSession ->expects($this->any()) ->method('getUser') |