Fix LdapBackendForm unit test

refs #4786
This commit is contained in:
Matthias Jentsch 2013-11-13 18:33:34 +01:00
parent d65bd33205
commit 984ed0b006
2 changed files with 7 additions and 7 deletions

View File

@ -44,9 +44,12 @@ class LdapBackendForm extends BaseBackendForm
/**
* Create this form and add all required elements
*
* @param $options Only useful for testing purposes:
* 'resources' => All available resources.
*
* @see Form::create()
*/
public function create()
public function create($options = array())
{
$this->setName('form_modify_backend');
$name = $this->filterName($this->getBackendName());
@ -73,7 +76,8 @@ class LdapBackendForm extends BaseBackendForm
'allowEmpty' => false,
'helptext' => 'The database connection to use for authenticating with this provider',
'value' => $this->getBackend()->get('resource'),
'multiOptions' => $this->getLdapResources()
'multiOptions' => array_key_exists('resources', $options) ?
$options['resources'] : $this->getLdapResources()
)
);

View File

@ -100,17 +100,13 @@ class AuthenticationFormTest extends BaseTestCase
array(
'backend' => 'ldap',
'target' => 'user',
'hostname' => 'test host',
'root_dn' => 'ou=test,dc=icinga,dc=org',
'bind_dn' => 'cn=testuser,cn=config',
'bind_pw' => 'password',
'user_class' => 'testClass',
'user_name_attribute' => 'testAttribute'
)
);
$form->setBackendName('testldap');
$form->setBackend($config);
$form->create();
$form->create(array('resources' => array()));
// parameters to be hidden
$notShown = array('backend', 'target');