diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-09-02 11:02:12 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-09-06 09:29:27 +0200 |
commit | 5fb2eee5df6bfbe3d608709fbe6997860fe4d648 (patch) | |
tree | c94f53f8128e92268ff10755066f3d0d2ef76b38 /apps/user_ldap/tests/User | |
parent | 798dd401391bc9d88292b50f9a17f01546f70624 (diff) | |
download | nextcloud-server-5fb2eee5df6bfbe3d608709fbe6997860fe4d648.tar.gz nextcloud-server-5fb2eee5df6bfbe3d608709fbe6997860fe4d648.zip |
Fix getMock user_ldap
Diffstat (limited to 'apps/user_ldap/tests/User')
-rw-r--r-- | apps/user_ldap/tests/User/ManagerTest.php | 27 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/UserTest.php | 44 |
2 files changed, 45 insertions, 26 deletions
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php index b3f22d6a068..16d6a3d9d6e 100644 --- a/apps/user_ldap/tests/User/ManagerTest.php +++ b/apps/user_ldap/tests/User/ManagerTest.php @@ -26,7 +26,16 @@ namespace OCA\User_LDAP\Tests\User; +use OCA\User_LDAP\FilesystemHelper; +use OCA\User_LDAP\ILDAPWrapper; +use OCA\User_LDAP\LogWrapper; +use OCA\User_LDAP\User\IUserTools; use OCA\User_LDAP\User\Manager; +use OCP\IAvatarManager; +use OCP\IConfig; +use OCP\IDBConnection; +use OCP\Image; +use OCP\IUserManager; /** * Class Test_User_Manager @@ -38,17 +47,17 @@ use OCA\User_LDAP\User\Manager; class ManagerTest extends \Test\TestCase { private function getTestInstances() { - $access = $this->getMock('\OCA\User_LDAP\User\IUserTools'); - $config = $this->getMock('\OCP\IConfig'); - $filesys = $this->getMock('\OCA\User_LDAP\FilesystemHelper'); - $log = $this->getMock('\OCA\User_LDAP\LogWrapper'); - $avaMgr = $this->getMock('\OCP\IAvatarManager'); - $image = $this->getMock('\OCP\Image'); - $dbc = $this->getMock('\OCP\IDBConnection'); - $userMgr = $this->getMock('\OCP\IUserManager'); + $access = $this->createMock(IUserTools::class); + $config = $this->createMock(IConfig::class); + $filesys = $this->createMock(FilesystemHelper::class); + $log = $this->createMock(LogWrapper::class); + $avaMgr = $this->createMock(IAvatarManager::class); + $image = $this->createMock(Image::class); + $dbc = $this->createMock(IDBConnection::class); + $userMgr = $this->createMock(IUserManager::class); $connection = new \OCA\User_LDAP\Connection( - $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper'), + $lw = $this->createMock(ILDAPWrapper::class), '', null ); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index d9e43dee047..6e6e2ad66b1 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -25,7 +25,17 @@ namespace OCA\User_LDAP\Tests\User; +use OCA\User_LDAP\FilesystemHelper; +use OCA\User_LDAP\ILDAPWrapper; +use OCA\User_LDAP\LogWrapper; +use OCA\User_LDAP\User\IUserTools; use OCA\User_LDAP\User\User; +use OCP\IAvatar; +use OCP\IAvatarManager; +use OCP\IConfig; +use OCP\IDBConnection; +use OCP\Image; +use OCP\IUser; use OCP\IUserManager; /** @@ -38,14 +48,14 @@ use OCP\IUserManager; class UserTest extends \Test\TestCase { private function getTestInstances() { - $access = $this->getMock('\OCA\User_LDAP\User\IUserTools'); - $config = $this->getMock('\OCP\IConfig'); - $filesys = $this->getMock('\OCA\User_LDAP\FilesystemHelper'); - $log = $this->getMock('\OCA\User_LDAP\LogWrapper'); - $avaMgr = $this->getMock('\OCP\IAvatarManager'); - $image = $this->getMock('\OCP\Image'); - $dbc = $this->getMock('\OCP\IDBConnection'); - $userMgr = $this->getMock('\OCP\IUserManager'); + $access = $this->createMock(IUserTools::class); + $config = $this->createMock(IConfig::class); + $filesys = $this->createMock(FilesystemHelper::class); + $log = $this->createMock(LogWrapper::class); + $avaMgr = $this->createMock(IAvatarManager::class); + $image = $this->createMock(Image::class); + $dbc = $this->createMock(IDBConnection::class); + $userMgr = $this->createMock(IUserManager::class); return array($access, $config, $filesys, $image, $log, $avaMgr, $dbc, $userMgr); } @@ -62,10 +72,10 @@ class UserTest extends \Test\TestCase { unset($accMethods[array_search('getConnection', $accMethods)]); $umMethods = get_class_methods('\OCA\User_LDAP\User\Manager'); } - $lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper'); - $im = $this->getMock('\OCP\Image'); + $lw = $this->createMock(ILDAPWrapper::class); + $im = $this->createMock(Image::class); if (is_null($userMgr)) { - $userMgr = $this->getMock('\OCP\IUserManager'); + $userMgr = $this->createMock(IUserManager::class); } $um = $this->getMock('\OCA\User_LDAP\User\Manager', $umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr)); @@ -212,7 +222,7 @@ class UserTest extends \Test\TestCase { $this->equalTo('myquota')) ->will($this->returnValue(array('42 GB'))); - $user = $this->getMock('\OCP\IUser'); + $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('setQuota') ->with('42 GB'); @@ -257,7 +267,7 @@ class UserTest extends \Test\TestCase { $this->equalTo('myquota')) ->will($this->returnValue(false)); - $user = $this->getMock('\OCP\IUser'); + $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('setQuota') ->with('25 GB'); @@ -302,7 +312,7 @@ class UserTest extends \Test\TestCase { $this->equalTo('myquota')) ->will($this->returnValue(array('27 GB'))); - $user = $this->getMock('\OCP\IUser'); + $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('setQuota') ->with('27 GB'); @@ -416,7 +426,7 @@ class UserTest extends \Test\TestCase { $access->expects($this->never()) ->method('readAttribute'); - $user = $this->getMock('\OCP\IUser'); + $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('setQuota') ->with($readQuota); @@ -466,7 +476,7 @@ class UserTest extends \Test\TestCase { ->method('isLoaded') ->will($this->returnValue(true)); - $avatar = $this->getMock('\OCP\IAvatar'); + $avatar = $this->createMock(IAvatar::class); $avatar->expects($this->once()) ->method('set') ->with($this->isInstanceOf($image)); @@ -524,7 +534,7 @@ class UserTest extends \Test\TestCase { ->method('isLoaded') ->will($this->returnValue(true)); - $avatar = $this->getMock('\OCP\IAvatar'); + $avatar = $this->createMock(IAvatar::class); $avatar->expects($this->once()) ->method('set') ->with($this->isInstanceOf($image)); |