diff --git a/application/forms/Config/Authentication/AutologinBackendForm.php b/application/forms/Config/Authentication/AutologinBackendForm.php index 4f4df73e3..05e1f201d 100644 --- a/application/forms/Config/Authentication/AutologinBackendForm.php +++ b/application/forms/Config/Authentication/AutologinBackendForm.php @@ -82,7 +82,7 @@ class AutologinBackendForm extends Form * * @return bool Whether validation succeeded or not */ - public function isValidAuthenticationBackend(Form $form) + public static function isValidAuthenticationBackend(Form $form) { return true; } diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 23335f8fa..9e000753c 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -88,7 +88,7 @@ class DbBackendForm extends Form */ public function onSuccess(Request $request) { - if (false === $this->isValidAuthenticationBackend($this)) { + if (false === static::isValidAuthenticationBackend($this)) { return false; } } @@ -100,7 +100,7 @@ class DbBackendForm extends Form * * @return bool Whether validation succeeded or not */ - public function isValidAuthenticationBackend(Form $form) + public static function isValidAuthenticationBackend(Form $form) { $element = $form->getElement('resource'); diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 6056b0911..a93141f37 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -108,7 +108,7 @@ class LdapBackendForm extends Form */ public function onSuccess(Request $request) { - if (false === $this->isValidAuthenticationBackend($this)) { + if (false === static::isValidAuthenticationBackend($this)) { return false; } } @@ -120,7 +120,7 @@ class LdapBackendForm extends Form * * @return bool Whether validation succeeded or not */ - public function isValidAuthenticationBackend(Form $form) + public static function isValidAuthenticationBackend(Form $form) { $element = $form->getElement('resource'); diff --git a/application/forms/Config/AuthenticationBackendConfigForm.php b/application/forms/Config/AuthenticationBackendConfigForm.php index e81382cd4..1e893fd00 100644 --- a/application/forms/Config/AuthenticationBackendConfigForm.php +++ b/application/forms/Config/AuthenticationBackendConfigForm.php @@ -201,7 +201,7 @@ class AuthenticationBackendConfigForm extends ConfigForm { if (($el = $this->getElement('force_creation')) === null || false === $el->isChecked()) { $backendForm = $this->getBackendForm($this->getElement('type')->getValue()); - if (false === $backendForm->isValidAuthenticationBackend($this)) { + if (false === $backendForm::isValidAuthenticationBackend($this)) { $this->addElement($this->getForceCreationCheckbox()); return false; } diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 4fd7297d9..686013386 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -103,7 +103,7 @@ class DbResourceForm extends Form */ public function onSuccess(Request $request) { - if (false === $this->isValidResource($this)) { + if (false === static::isValidResource($this)) { return false; } } @@ -115,7 +115,7 @@ class DbResourceForm extends Form * * @return bool Whether validation succeeded or not */ - public function isValidResource(Form $form) + public static function isValidResource(Form $form) { try { $resource = ResourceFactory::createResource(new Zend_Config($form->getValues())); diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php index 6196f3a17..6dacc6bea 100644 --- a/application/forms/Config/Resource/LdapResourceForm.php +++ b/application/forms/Config/Resource/LdapResourceForm.php @@ -89,7 +89,7 @@ class LdapResourceForm extends Form */ public function onSuccess(Request $request) { - if (false === $this->isValidResource($this)) { + if (false === static::isValidResource($this)) { return false; } } @@ -101,7 +101,7 @@ class LdapResourceForm extends Form * * @return bool Whether validation succeeded or not */ - public function isValidResource(Form $form) + public static function isValidResource(Form $form) { try { $resource = ResourceFactory::createResource(new Zend_Config($form->getValues())); diff --git a/application/forms/Config/Resource/LivestatusResourceForm.php b/application/forms/Config/Resource/LivestatusResourceForm.php index 92534f220..3314ca284 100644 --- a/application/forms/Config/Resource/LivestatusResourceForm.php +++ b/application/forms/Config/Resource/LivestatusResourceForm.php @@ -50,7 +50,7 @@ class LivestatusResourceForm extends Form */ public function onSuccess(Request $request) { - if (false === $this->isValidResource($this)) { + if (false === static::isValidResource($this)) { return false; } } @@ -62,7 +62,7 @@ class LivestatusResourceForm extends Form * * @return bool Whether validation succeeded or not */ - public function isValidResource(Form $form) + public static function isValidResource(Form $form) { try { $resource = ResourceFactory::createResource(new Zend_Config($form->getValues())); diff --git a/application/forms/Config/ResourceConfigForm.php b/application/forms/Config/ResourceConfigForm.php index 8e677cf8b..51677b12f 100644 --- a/application/forms/Config/ResourceConfigForm.php +++ b/application/forms/Config/ResourceConfigForm.php @@ -135,7 +135,7 @@ class ResourceConfigForm extends ConfigForm { if (($el = $this->getElement('force_creation')) === null || false === $el->isChecked()) { $resourceForm = $this->getResourceForm($this->getElement('type')->getValue()); - if (method_exists($resourceForm, 'isValidResource') && false === $resourceForm->isValidResource($this)) { + if (method_exists($resourceForm, 'isValidResource') && false === $resourceForm::isValidResource($this)) { $this->addElement($this->getForceCreationCheckbox()); return false; } diff --git a/test/php/application/forms/Config/Authentication/DbBackendFormTest.php b/test/php/application/forms/Config/Authentication/DbBackendFormTest.php index 3364dff60..7474d2703 100644 --- a/test/php/application/forms/Config/Authentication/DbBackendFormTest.php +++ b/test/php/application/forms/Config/Authentication/DbBackendFormTest.php @@ -37,7 +37,7 @@ class DbBackendFormTest extends BaseTestCase $form->populate(array('resource' => 'test_db_backend')); $this->assertTrue( - $form->isValidAuthenticationBackend($form), + DbBackendForm::isValidAuthenticationBackend($form), 'DbBackendForm claims that a valid authentication backend with users is not valid' ); } @@ -59,7 +59,7 @@ class DbBackendFormTest extends BaseTestCase $form->populate(array('resource' => 'test_db_backend')); $this->assertFalse( - $form->isValidAuthenticationBackend($form), + DbBackendForm::isValidAuthenticationBackend($form), 'DbBackendForm claims that an invalid authentication backend without users is valid' ); } diff --git a/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php b/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php index 0335d1f82..c38f26376 100644 --- a/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php +++ b/test/php/application/forms/Config/Authentication/LdapBackendFormTest.php @@ -37,7 +37,7 @@ class LdapBackendFormTest extends BaseTestCase $form->populate(array('resource' => 'test_ldap_backend')); $this->assertTrue( - $form->isValidAuthenticationBackend($form), + LdapBackendForm::isValidAuthenticationBackend($form), 'LdapBackendForm claims that a valid authentication backend with users is not valid' ); } @@ -58,7 +58,7 @@ class LdapBackendFormTest extends BaseTestCase $form->populate(array('resource' => 'test_ldap_backend')); $this->assertFalse( - $form->isValidAuthenticationBackend($form), + LdapBackendForm::isValidAuthenticationBackend($form), 'LdapBackendForm claims that an invalid authentication backend without users is valid' ); } diff --git a/test/php/application/forms/Config/Resource/DbResourceFormTest.php b/test/php/application/forms/Config/Resource/DbResourceFormTest.php index 1b624c49f..a962375b5 100644 --- a/test/php/application/forms/Config/Resource/DbResourceFormTest.php +++ b/test/php/application/forms/Config/Resource/DbResourceFormTest.php @@ -30,10 +30,8 @@ class DbResourceFormTest extends BaseTestCase Mockery::mock()->shouldReceive('getConnection')->atMost()->twice()->andReturn(Mockery::self())->getMock() ); - $form = new DbResourceForm(); - $this->assertTrue( - $form->isValidResource($form), + DbResourceForm::isValidResource(new DbResourceForm()), 'ResourceForm claims that a valid db resource is not valid' ); } @@ -48,10 +46,8 @@ class DbResourceFormTest extends BaseTestCase Mockery::mock()->shouldReceive('getConnection')->once()->andThrow('\Exception')->getMock() ); - $form = new DbResourceForm(); - $this->assertFalse( - $form->isValidResource($form), + DbResourceForm::isValidResource(new DbResourceForm()), 'ResourceForm claims that an invalid db resource is valid' ); } diff --git a/test/php/application/forms/Config/Resource/LdapResourceFormTest.php b/test/php/application/forms/Config/Resource/LdapResourceFormTest.php index 078a11146..b17a01a06 100644 --- a/test/php/application/forms/Config/Resource/LdapResourceFormTest.php +++ b/test/php/application/forms/Config/Resource/LdapResourceFormTest.php @@ -30,10 +30,8 @@ class LdapResourceFormTest extends BaseTestCase Mockery::mock()->shouldReceive('connect')->getMock() ); - $form = new LdapResourceForm(); - $this->assertTrue( - $form->isValidResource($form), + LdapResourceForm::isValidResource(new LdapResourceForm()), 'ResourceForm claims that a valid ldap resource is not valid' ); } @@ -48,10 +46,8 @@ class LdapResourceFormTest extends BaseTestCase Mockery::mock()->shouldReceive('connect')->once()->andThrow('\Exception')->getMock() ); - $form = new LdapResourceForm(); - $this->assertFalse( - $form->isValidResource($form), + LdapResourceForm::isValidResource(new LdapResourceForm()), 'ResourceForm claims that an invalid ldap resource is valid' ); } diff --git a/test/php/application/forms/Config/Resource/LivestatusResourceFormTest.php b/test/php/application/forms/Config/Resource/LivestatusResourceFormTest.php index 300adebed..5748d7c53 100644 --- a/test/php/application/forms/Config/Resource/LivestatusResourceFormTest.php +++ b/test/php/application/forms/Config/Resource/LivestatusResourceFormTest.php @@ -31,10 +31,8 @@ class LivestatusResourceFormTest extends BaseTestCase ->shouldReceive('disconnect')->getMock() ); - $form = new LivestatusResourceForm(); - $this->assertTrue( - $form->isValidResource($form), + LivestatusResourceForm::isValidResource(new LivestatusResourceForm()), 'ResourceForm claims that a valid livestatus resource is not valid' ); } @@ -49,10 +47,8 @@ class LivestatusResourceFormTest extends BaseTestCase Mockery::mock()->shouldReceive('connect')->once()->andThrow('\Exception')->getMock() ); - $form = new LivestatusResourceForm(); - $this->assertFalse( - $form->isValidResource($form), + LivestatusResourceForm::isValidResource(new LivestatusResourceForm()), 'ResourceForm claims that an invalid livestatus resource is valid' ); }