mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
parent
cee3c32fa5
commit
31978e1236
@ -6,6 +6,7 @@ namespace Icinga\Form\Config\Authentication;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
use Icinga\Web\Request;
|
||||||
use Icinga\Data\ResourceFactory;
|
use Icinga\Data\ResourceFactory;
|
||||||
use Icinga\Authentication\Backend\LdapUserBackend;
|
use Icinga\Authentication\Backend\LdapUserBackend;
|
||||||
|
|
||||||
|
@ -29,16 +29,15 @@ class LdapBackendFormTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$this->setUpResourceFactoryMock();
|
$this->setUpResourceFactoryMock();
|
||||||
Mockery::mock('overload:Icinga\Authentication\Backend\LdapUserBackend')
|
Mockery::mock('overload:Icinga\Authentication\Backend\LdapUserBackend')
|
||||||
->shouldReceive('assertAuthenticationPossible')->andReturn(null);
|
->shouldReceive('assertAuthenticationPossible')->andReturnNull();
|
||||||
|
|
||||||
$form = new LdapBackendForm();
|
$form = new LdapBackendForm();
|
||||||
$form->setBackendName('test');
|
$form->setTokenDisabled();
|
||||||
$form->setResources(array('test_ldap_backend' => null));
|
$form->setResources(array('test_ldap_backend'));
|
||||||
$form->create();
|
$form->populate(array('resource' => 'test_ldap_backend'));
|
||||||
$form->populate(array('backend_test_resource' => 'test_ldap_backend'));
|
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$form->isValidAuthenticationBackend(),
|
$form->isValidAuthenticationBackend($form),
|
||||||
'LdapBackendForm claims that a valid authentication backend with users is not valid'
|
'LdapBackendForm claims that a valid authentication backend with users is not valid'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -54,13 +53,12 @@ class LdapBackendFormTest extends BaseTestCase
|
|||||||
->shouldReceive('assertAuthenticationPossible')->andThrow(new AuthenticationException);
|
->shouldReceive('assertAuthenticationPossible')->andThrow(new AuthenticationException);
|
||||||
|
|
||||||
$form = new LdapBackendForm();
|
$form = new LdapBackendForm();
|
||||||
$form->setBackendName('test');
|
$form->setTokenDisabled();
|
||||||
$form->setResources(array('test_ldap_backend' => null));
|
$form->setResources(array('test_ldap_backend'));
|
||||||
$form->create();
|
$form->populate(array('resource' => 'test_ldap_backend'));
|
||||||
$form->populate(array('backend_test_resource' => 'test_ldap_backend'));
|
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$form->isValidAuthenticationBackend(),
|
$form->isValidAuthenticationBackend($form),
|
||||||
'LdapBackendForm claims that an invalid authentication backend without users is valid'
|
'LdapBackendForm claims that an invalid authentication backend without users is valid'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user