summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2015-04-09 14:03:30 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-04-10 11:08:24 +0200
commitfafecd1c05cebbd983d8c770d36c5d546a83b16b (patch)
tree4820146c542efbad0727d49783a095903ae82048 /apps/user_ldap
parent1427ea78d40bbfdc54d7ce603a96232b11f5a405 (diff)
downloadnextcloud-server-fafecd1c05cebbd983d8c770d36c5d546a83b16b.tar.gz
nextcloud-server-fafecd1c05cebbd983d8c770d36c5d546a83b16b.zip
fix cherrypicking
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/connection.php2
-rw-r--r--apps/user_ldap/tests/user/manager.php4
-rw-r--r--apps/user_ldap/tests/user_ldap.php27
3 files changed, 18 insertions, 15 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index fa6258445d8..b9d83aad684 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -30,10 +30,10 @@
namespace OCA\user_ldap\lib;
-//magic properties (incomplete)
use OC\ServerNotAvailableException;
/**
+ * magic properties (incomplete)
* responsible for LDAP connections in context with the provided configuration
*
* @property string ldapUserFilter
diff --git a/apps/user_ldap/tests/user/manager.php b/apps/user_ldap/tests/user/manager.php
index e1e98b57f80..e86db6b9f81 100644
--- a/apps/user_ldap/tests/user/manager.php
+++ b/apps/user_ldap/tests/user/manager.php
@@ -145,6 +145,8 @@ class Test_User_Manager extends \Test\TestCase {
$manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc);
$manager->setLdapAccess($access);
$user = $manager->get($inputDN);
+
+ $this->assertNull($user);
}
public function testGetByUidExisting() {
@@ -192,6 +194,8 @@ class Test_User_Manager extends \Test\TestCase {
$manager = new Manager($config, $filesys, $log, $avaMgr, $image, $dbc);
$manager->setLdapAccess($access);
$user = $manager->get($uid);
+
+ $this->assertNull($user);
}
}
diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php
index 9b4da00a3a7..53229e2d64a 100644
--- a/apps/user_ldap/tests/user_ldap.php
+++ b/apps/user_ldap/tests/user_ldap.php
@@ -435,7 +435,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
*/
public function testUserExistsForDeleted() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access);
+ $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
$this->prepareMockForUserExists($access);
$access->expects($this->any())
@@ -453,7 +453,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
public function testUserExistsForNeverExisting() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access);
+ $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
$this->prepareMockForUserExists($access);
$access->expects($this->any())
@@ -495,7 +495,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
*/
public function testUserExistsPublicAPIForDeleted() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access);
+ $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
$this->prepareMockForUserExists($access);
\OC_User::useBackend($backend);
@@ -514,7 +514,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
public function testUserExistsPublicAPIForNeverExisting() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access);
+ $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
$this->prepareMockForUserExists($access);
\OC_User::useBackend($backend);
@@ -571,19 +571,15 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
}
}));
- $datadir = '/my/data/dir';
- $config->expects($this->once())
- ->method('getSystemValue')
- ->will($this->returnValue($datadir));
-
//absolut path
$result = $backend->getHome('gunslinger');
$this->assertEquals('/tmp/rolandshome/', $result);
}
- public function testGetHomeDatadirRelative() {
+ public function testGetHomeRelative() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access);
+ $config = $this->getMock('\OCP\IConfig');
+ $backend = new UserLDAP($access, $config);
$this->prepareMockForUserExists($access);
$access->connection->expects($this->any())
@@ -610,9 +606,12 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
}
}));
//datadir-relativ path
+ $datadir = '/my/data/dir';
+ $config->expects($this->once())
+ ->method('getSystemValue')
+ ->will($this->returnValue($datadir));
+
$result = $backend->getHome('ladyofshadows');
- $datadir = \OCP\Config::getSystemValue('datadirectory',
- \OC::$SERVERROOT.'/data');
$this->assertEquals($datadir.'/susannah/', $result);
}
@@ -621,7 +620,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
*/
public function testGetHomeNoPath() {
$access = $this->getAccessMock();
- $backend = new UserLDAP($access);
+ $backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
$this->prepareMockForUserExists($access);
$access->connection->expects($this->any())