Open Journal Systems  3.3.0
FormValidatorInSetTest.php
1 <?php
2 
17 import('lib.pkp.tests.PKPTestCase');
18 import('lib.pkp.classes.form.Form');
19 
25  public function testIsValid() {
26  $form = new Form('some template');
27 
28  // Instantiate test validator
29  $acceptedValues = array('val1', 'val2');
30  $validator = new FormValidatorInSet($form, 'testData', FORM_VALIDATOR_REQUIRED_VALUE, 'some.message.key', $acceptedValues);
31 
32  $form->setData('testData', 'val1');
33  self::assertTrue($validator->isValid());
34 
35  $form->setData('testData', 'anything else');
36  self::assertFalse($validator->isValid());
37  }
38 }
39 
FormValidatorInSetTest
Test class for FormValidatorInSet.
Definition: FormValidatorInSetTest.php:20
FormValidatorInSetTest\testIsValid
testIsValid()
Definition: FormValidatorInSetTest.php:25
PKPTestCase
Class that implements functionality common to all PKP unit test cases.
Definition: PKPTestCase.inc.php:27
FormValidatorInSet
Form validation check that checks if value is within a certain set.
Definition: FormValidatorInSet.inc.php:18
Form
Class defining basic operations for handling HTML forms.
Definition: Form.inc.php:47