From 31978e12360afac8eed56180147f4eb55a5c7f82 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 9 Sep 2014 10:36:42 +0200 Subject: [PATCH] Fix LdapBackendFormTest refs #5525 --- .../Config/Authentication/LdapBackendForm.php | 1 + .../Authentication/LdapBackendFormTest.php | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 4e3172ad2..a0c20b949 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -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; diff --git a/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php b/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php index 209b7a675..0335d1f82 100644 --- a/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php +++ b/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php @@ -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' ); }