Fix LdapBackendFormTest

refs #5525
This commit is contained in:
Johannes Meyer 2014-09-09 10:36:42 +02:00
parent cee3c32fa5
commit 31978e1236
2 changed files with 10 additions and 11 deletions

View File

@ -6,6 +6,7 @@ namespace Icinga\Form\Config\Authentication;
use Exception;
use Icinga\Web\Form;
use Icinga\Web\Request;
use Icinga\Data\ResourceFactory;
use Icinga\Authentication\Backend\LdapUserBackend;

View File

@ -29,16 +29,15 @@ class LdapBackendFormTest extends BaseTestCase
{
$this->setUpResourceFactoryMock();
Mockery::mock('overload:Icinga\Authentication\Backend\LdapUserBackend')
->shouldReceive('assertAuthenticationPossible')->andReturn(null);
->shouldReceive('assertAuthenticationPossible')->andReturnNull();
$form = new LdapBackendForm();
$form->setBackendName('test');
$form->setResources(array('test_ldap_backend' => null));
$form->create();
$form->populate(array('backend_test_resource' => 'test_ldap_backend'));
$form->setTokenDisabled();
$form->setResources(array('test_ldap_backend'));
$form->populate(array('resource' => 'test_ldap_backend'));
$this->assertTrue(
$form->isValidAuthenticationBackend(),
$form->isValidAuthenticationBackend($form),
'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);
$form = new LdapBackendForm();
$form->setBackendName('test');
$form->setResources(array('test_ldap_backend' => null));
$form->create();
$form->populate(array('backend_test_resource' => 'test_ldap_backend'));
$form->setTokenDisabled();
$form->setResources(array('test_ldap_backend'));
$form->populate(array('resource' => 'test_ldap_backend'));
$this->assertFalse(
$form->isValidAuthenticationBackend(),
$form->isValidAuthenticationBackend($form),
'LdapBackendForm claims that an invalid authentication backend without users is valid'
);
}