diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-01-07 00:52:18 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-01-07 00:52:18 +0100 |
commit | b9235e2a24ada2bf69fc23cd83405661bde7f0da (patch) | |
tree | f73ab7e9ca94e9a0a19d0ddbb9a82a7dc91c16b4 /apps/user_ldap/tests | |
parent | 64f0b055e67974141cf2e156d2b062f55768ce7d (diff) | |
download | nextcloud-server-b9235e2a24ada2bf69fc23cd83405661bde7f0da.tar.gz nextcloud-server-b9235e2a24ada2bf69fc23cd83405661bde7f0da.zip |
inject DB Connection to user manager
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r-- | apps/user_ldap/tests/access.php | 3 | ||||
-rw-r--r-- | apps/user_ldap/tests/group_ldap.php | 3 | ||||
-rw-r--r-- | apps/user_ldap/tests/user/manager.php | 27 | ||||
-rw-r--r-- | apps/user_ldap/tests/user/user.php | 63 | ||||
-rw-r--r-- | apps/user_ldap/tests/user_ldap.php | 3 |
5 files changed, 52 insertions, 47 deletions
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php index 85849229152..5c502f288eb 100644 --- a/apps/user_ldap/tests/access.php +++ b/apps/user_ldap/tests/access.php @@ -47,7 +47,8 @@ class Test_Access extends \Test\TestCase { $this->getMock('\OCA\user_ldap\lib\FilesystemHelper'), $this->getMock('\OCA\user_ldap\lib\LogWrapper'), $this->getMock('\OCP\IAvatarManager'), - $this->getMock('\OCP\Image'))); + $this->getMock('\OCP\Image'), + $this->getMock('\OCP\IDBConnection'))); return array($lw, $connector, $um); } diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php index 0e01eb3ba6f..efd7f803f3b 100644 --- a/apps/user_ldap/tests/group_ldap.php +++ b/apps/user_ldap/tests/group_ldap.php @@ -45,7 +45,8 @@ class Test_Group_Ldap extends \Test\TestCase { $this->getMock('\OCA\user_ldap\lib\FilesystemHelper'), $this->getMock('\OCA\user_ldap\lib\LogWrapper'), $this->getMock('\OCP\IAvatarManager'), - $this->getMock('\OCP\Image') + $this->getMock('\OCP\Image'), + $this->getMock('\OCP\IDBConnection') ); $access = $this->getMock('\OCA\user_ldap\lib\Access', $accMethods, diff --git a/apps/user_ldap/tests/user/manager.php b/apps/user_ldap/tests/user/manager.php index fb47f60539f..4ce504365b8 100644 --- a/apps/user_ldap/tests/user/manager.php +++ b/apps/user_ldap/tests/user/manager.php @@ -33,12 +33,13 @@ class Test_User_Manager extends \Test\TestCase { $log = $this->getMock('\OCA\user_ldap\lib\LogWrapper'); $avaMgr = $this->getMock('\OCP\IAvatarManager'); $image = $this->getMock('\OCP\Image'); + $dbc = $this->getMock('\OCP\IDBConnection'); - return array($access, $config, $filesys, $image, $log, $avaMgr); + return array($access, $config, $filesys, $image, $log, $avaMgr, $dbc); } public function testGetByDNExisting() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); $inputDN = 'cn=foo,dc=foobar,dc=bar'; @@ -57,7 +58,7 @@ class Test_User_Manager extends \Test\TestCase { $access->expects($this->never()) ->method('username2dn'); - $manager = new Manager($config, $filesys, $log, $avaMgr, $image); + $manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc); $manager->setLdapAccess($access); $user = $manager->get($inputDN); @@ -65,7 +66,7 @@ class Test_User_Manager extends \Test\TestCase { } public function testGetByEDirectoryDN() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); $inputDN = 'uid=foo,o=foobar,c=bar'; @@ -84,7 +85,7 @@ class Test_User_Manager extends \Test\TestCase { $access->expects($this->never()) ->method('username2dn'); - $manager = new Manager($config, $filesys, $log, $avaMgr, $image); + $manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc); $manager->setLdapAccess($access); $user = $manager->get($inputDN); @@ -92,7 +93,7 @@ class Test_User_Manager extends \Test\TestCase { } public function testGetByExoticDN() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); $inputDN = 'ab=cde,f=ghei,mno=pq'; @@ -111,7 +112,7 @@ class Test_User_Manager extends \Test\TestCase { $access->expects($this->never()) ->method('username2dn'); - $manager = new Manager($config, $filesys, $log, $avaMgr, $image); + $manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc); $manager->setLdapAccess($access); $user = $manager->get($inputDN); @@ -119,7 +120,7 @@ class Test_User_Manager extends \Test\TestCase { } public function testGetByDNNotExisting() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); $inputDN = 'cn=gone,dc=foobar,dc=bar'; @@ -139,7 +140,7 @@ class Test_User_Manager extends \Test\TestCase { ->with($this->equalTo($inputDN)) ->will($this->returnValue(false)); - $manager = new Manager($config, $filesys, $log, $avaMgr, $image); + $manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc); $manager->setLdapAccess($access); $user = $manager->get($inputDN); @@ -147,7 +148,7 @@ class Test_User_Manager extends \Test\TestCase { } public function testGetByUidExisting() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); $dn = 'cn=foo,dc=foobar,dc=bar'; @@ -166,7 +167,7 @@ class Test_User_Manager extends \Test\TestCase { ->with($this->equalTo($uid)) ->will($this->returnValue(false)); - $manager = new Manager($config, $filesys, $log, $avaMgr, $image); + $manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc); $manager->setLdapAccess($access); $user = $manager->get($uid); @@ -174,7 +175,7 @@ class Test_User_Manager extends \Test\TestCase { } public function testGetByUidNotExisting() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); $dn = 'cn=foo,dc=foobar,dc=bar'; @@ -188,7 +189,7 @@ class Test_User_Manager extends \Test\TestCase { ->with($this->equalTo($uid)) ->will($this->returnValue(false)); - $manager = new Manager($config, $filesys, $log, $avaMgr, $image); + $manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc); $manager->setLdapAccess($access); $user = $manager->get($uid); diff --git a/apps/user_ldap/tests/user/user.php b/apps/user_ldap/tests/user/user.php index e110921d2d3..5282a9f8b6e 100644 --- a/apps/user_ldap/tests/user/user.php +++ b/apps/user_ldap/tests/user/user.php @@ -33,11 +33,12 @@ class Test_User_User extends \Test\TestCase { $log = $this->getMock('\OCA\user_ldap\lib\LogWrapper'); $avaMgr = $this->getMock('\OCP\IAvatarManager'); $image = $this->getMock('\OCP\Image'); + $dbc = $this->getMock('\OCP\IDBConnection'); - return array($access, $config, $filesys, $image, $log, $avaMgr); + return array($access, $config, $filesys, $image, $log, $avaMgr, $dbc); } - private function getAdvancedMocks($cfMock, $fsMock, $logMock, $avaMgr) { + private function getAdvancedMocks($cfMock, $fsMock, $logMock, $avaMgr, $dbc) { static $conMethods; static $accMethods; static $umMethods; @@ -52,7 +53,7 @@ class Test_User_User extends \Test\TestCase { $lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper'); $im = $this->getMock('\OCP\Image'); $um = $this->getMock('\OCA\user_ldap\lib\user\Manager', - $umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im)); + $umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc)); $connector = $this->getMock('\OCA\user_ldap\lib\Connection', $conMethods, array($lw, null, null)); $access = $this->getMock('\OCA\user_ldap\lib\Access', @@ -76,11 +77,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateEmailProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->once()) ->method('__get') @@ -110,11 +111,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateEmailNotProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->once()) ->method('__get') @@ -140,11 +141,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateEmailNotConfigured() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->once()) ->method('__get') @@ -167,11 +168,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateQuotaAllProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->at(0)) ->method('__get') @@ -210,11 +211,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateQuotaDefaultProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->at(0)) ->method('__get') @@ -253,11 +254,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateQuotaIndividualProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->at(0)) ->method('__get') @@ -296,11 +297,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateQuotaNoneProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->at(0)) ->method('__get') @@ -334,11 +335,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateQuotaNoneConfigured() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $connection->expects($this->at(0)) ->method('__get') @@ -370,11 +371,11 @@ class Test_User_User extends \Test\TestCase { //the testUpdateAvatar series also implicitely tests getAvatarImage public function testUpdateAvatarJpegPhotoProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $access->expects($this->once()) ->method('readAttribute') @@ -419,11 +420,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateAvatarThumbnailPhotoProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $access->expects($this->at(0)) ->method('readAttribute') @@ -477,11 +478,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateAvatarNotProvided() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $access->expects($this->at(0)) ->method('readAttribute') @@ -523,11 +524,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateBeforeFirstLogin() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $config->expects($this->at(0)) ->method('getUserValue') @@ -559,11 +560,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateAfterFirstLogin() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $config->expects($this->at(0)) ->method('getUserValue') @@ -599,11 +600,11 @@ class Test_User_User extends \Test\TestCase { } public function testUpdateNoRefresh() { - list($access, $config, $filesys, $image, $log, $avaMgr) = + list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances(); list($access, $connection) = - $this->getAdvancedMocks($config, $filesys, $log, $avaMgr); + $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc); $config->expects($this->at(0)) ->method('getUserValue') diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php index c4ba4f45795..3fa4f2bf0a1 100644 --- a/apps/user_ldap/tests/user_ldap.php +++ b/apps/user_ldap/tests/user_ldap.php @@ -62,7 +62,8 @@ class Test_User_Ldap_Direct extends \Test\TestCase { $this->getMock('\OCA\user_ldap\lib\FilesystemHelper'), $this->getMock('\OCA\user_ldap\lib\LogWrapper'), $this->getMock('\OCP\IAvatarManager'), - $this->getMock('\OCP\Image') + $this->getMock('\OCP\Image'), + $this->getMock('\OCP\IDBConnection') ); $access = $this->getMock('\OCA\user_ldap\lib\Access', |