diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php
index ad75a38436983bb236084227771ea5ae264e0cec..d5759c597a25a1503565efaebd1d824b72eea7dc 100644
--- a/apps/user_ldap/ajax/wizard.php
+++ b/apps/user_ldap/ajax/wizard.php
@@ -39,9 +39,24 @@ if(!isset($_POST['ldap_serverconfig_chooser'])) {
 }
 $prefix = $_POST['ldap_serverconfig_chooser'];
 
-$ldapWrapper = new OCA\user_ldap\lib\LDAP();
+$ldapWrapper = new \OCA\user_ldap\lib\LDAP();
 $configuration = new \OCA\user_ldap\lib\Configuration($prefix);
-$wizard = new \OCA\user_ldap\lib\Wizard($configuration, $ldapWrapper);
+
+$con = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);
+$con->setConfiguration($configuration->getConfiguration());
+$con->ldapConfigurationActive = true;
+$con->setIgnoreValidation(true);
+
+$userManager = new \OCA\user_ldap\lib\user\Manager(
+	\OC::$server->getConfig(),
+	new \OCA\user_ldap\lib\FilesystemHelper(),
+	new \OCA\user_ldap\lib\LogWrapper(),
+	\OC::$server->getAvatarManager(),
+	new \OCP\Image());
+
+$access = new \OCA\user_ldap\lib\Access($con, $ldapWrapper, $userManager);
+
+$wizard = new \OCA\user_ldap\lib\Wizard($configuration, $ldapWrapper, $access);
 
 switch($action) {
 	case 'guessPortAndTLS':
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index 9a7f7520f5602909b14384c89512efebbab6deda..25dc4598ffb8c76255df436a142828804b7d5878 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -25,6 +25,7 @@ namespace OCA\user_ldap\lib;
 
 class Wizard extends LDAPUtility {
 	static protected $l;
+	protected $access;
 	protected $cr;
 	protected $configuration;
 	protected $result;
@@ -48,12 +49,13 @@ class Wizard extends LDAPUtility {
 	 * @param Configuration $configuration an instance of Configuration
 	 * @param ILDAPWrapper $ldap an instance of ILDAPWrapper
 	 */
-	public function __construct(Configuration $configuration, ILDAPWrapper $ldap) {
+	public function __construct(Configuration $configuration, ILDAPWrapper $ldap, Access $access) {
 		parent::__construct($ldap);
 		$this->configuration = $configuration;
 		if(is_null(Wizard::$l)) {
 			Wizard::$l = \OC_L10N::get('user_ldap');
 		}
+		$this->access = $access;
 		$this->result = new WizardResult;
 	}
 
@@ -78,11 +80,10 @@ class Wizard extends LDAPUtility {
 			throw new \Exception('Requirements not met', 400);
 		}
 
-		$ldapAccess = $this->getAccess();
 		if($type === 'groups') {
-			$result =  $ldapAccess->countGroups($filter);
+			$result =  $this->access->countGroups($filter);
 		} else if($type === 'users') {
-			$result = $ldapAccess->countUsers($filter);
+			$result = $this->access->countUsers($filter);
 		} else {
 			throw new \Exception('internal error: invald object type', 500);
 		}
@@ -142,13 +143,12 @@ class Wizard extends LDAPUtility {
 			return  false;
 		}
 
-		$access = $this->getAccess();
-		$filter = $access->combineFilterWithAnd(array(
+		$filter = $this->access->combineFilterWithAnd(array(
 			$this->configuration->ldapUserFilter,
 			$attr . '=*'
 		));
 
-		return $access->countUsers($filter);
+		return $this->access->countUsers($filter);
 	}
 
 	/**
@@ -352,7 +352,6 @@ class Wizard extends LDAPUtility {
 	 */
 	public function fetchGroups($dbKey, $confKey) {
 		$obclasses = array('posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames');
-		$ldapAccess = $this->getAccess();
 
 		$filterParts = array();
 		foreach($obclasses as $obclass) {
@@ -361,15 +360,15 @@ class Wizard extends LDAPUtility {
 		//we filter for everything
 		//- that looks like a group and
 		//- has the group display name set
-		$filter = $ldapAccess->combineFilterWithOr($filterParts);
-		$filter = $ldapAccess->combineFilterWithAnd(array($filter, 'cn=*'));
+		$filter = $this->access->combineFilterWithOr($filterParts);
+		$filter = $this->access->combineFilterWithAnd(array($filter, 'cn=*'));
 
 		$groupNames = array();
 		$groupEntries = array();
 		$limit = 400;
 		$offset = 0;
 		do {
-			$result = $ldapAccess->searchGroups($filter, array('cn','dn'), $limit, $offset);
+			$result = $this->access->searchGroups($filter, array('cn'), $limit, $offset);
 			foreach($result as $item) {
 				$groupNames[] = $item['cn'];
 				$groupEntries[] = $item;
@@ -1168,27 +1167,6 @@ class Wizard extends LDAPUtility {
 		}
 	}
 
-	/**
-	 * creates and returns an Access instance
-	 * @return \OCA\user_ldap\lib\Access
-	 */
-	private function getAccess() {
-		$con = new Connection($this->ldap, '', null);
-		$con->setConfiguration($this->configuration->getConfiguration());
-		$con->ldapConfigurationActive = true;
-		$con->setIgnoreValidation(true);
-
-		$userManager = new user\Manager(
-			\OC::$server->getConfig(),
-			new FilesystemHelper(),
-			new LogWrapper(),
-			\OC::$server->getAvatarManager(),
-			new \OCP\Image());
-
-		$ldapAccess = new Access($con, $this->ldap, $userManager);
-		return $ldapAccess;
-	}
-
 	/**
 	 * @return bool|mixed
 	 */
diff --git a/apps/user_ldap/tests/wizard.php b/apps/user_ldap/tests/wizard.php
index 50461432c421d9c8ca0dcd0433ac45f49df57cbf..fcf4d71087f5aaa292377013dbf5da291fe81107 100644
--- a/apps/user_ldap/tests/wizard.php
+++ b/apps/user_ldap/tests/wizard.php
@@ -46,13 +46,24 @@ class Test_Wizard extends \PHPUnit_Framework_TestCase {
 		static $conMethods;
 
 		if(is_null($conMethods)) {
-			$conMethods = get_class_methods('\OCA\user_ldap\lib\Configuration');
+			$confMethods = get_class_methods('\OCA\user_ldap\lib\Configuration');
+			$connMethods = get_class_methods('\OCA\user_ldap\lib\Connection');
+			$accMethods  = get_class_methods('\OCA\user_ldap\lib\Access');
 		}
 		$lw   = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
 		$conf = $this->getMock('\OCA\user_ldap\lib\Configuration',
-							   $conMethods,
+							   $confMethods,
 							   array($lw, null, null));
-		return array(new Wizard($conf, $lw), $conf, $lw);
+
+		$connector = $this->getMock('\OCA\user_ldap\lib\Connection',
+			$connMethods, array($lw, null, null));
+		$um = $this->getMockBuilder('\OCA\user_ldap\lib\user\Manager')
+					->disableOriginalConstructor()
+					->getMock();
+		$access = $this->getMock('\OCA\user_ldap\lib\Access',
+			$accMethods, array($connector, $lw, $um));
+
+		return array(new Wizard($conf, $lw, $access), $conf, $lw);
 	}
 
 	private function prepareLdapWrapperForConnections(&$ldap) {