/**
  * @covers FormValidatorRegExp
  * @covers FormValidator
  */
 public function testIsValid()
 {
     $form = new Form('some template');
     $form->setData('testData', 'some data');
     $validator = new FormValidatorRegExp($form, 'testData', FORM_VALIDATOR_REQUIRED_VALUE, 'some.message.key', '/some.*/');
     self::assertTrue($validator->isValid());
     $validator = new FormValidatorRegExp($form, 'testData', FORM_VALIDATOR_REQUIRED_VALUE, 'some.message.key', '/some more.*/');
     self::assertFalse($validator->isValid());
 }
Пример #2
0
 /**
  * Constructor.
  * @see FormValidatorRegExp::FormValidatorRegExp()
  */
 function FormValidatorUrl(&$form, $field, $type, $message)
 {
     parent::FormValidatorRegExp($form, $field, $type, $message, FormValidatorUrl::getRegexp());
 }
Пример #3
0
 /**
  * Constructor.
  * @see FormValidatorRegExp::FormValidatorRegExp()
  */
 function FormValidatorAlphaNum(&$form, $field, $type, $message)
 {
     parent::FormValidatorRegExp($form, $field, $type, $message, '/^[A-Z0-9]+([\\-_][A-Z0-9]+)*$/i');
 }