/** * @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()); }
/** * Constructor. * @see FormValidatorRegExp::FormValidatorRegExp() */ function FormValidatorUrl(&$form, $field, $type, $message) { parent::FormValidatorRegExp($form, $field, $type, $message, FormValidatorUrl::getRegexp()); }
/** * Constructor. * @see FormValidatorRegExp::FormValidatorRegExp() */ function FormValidatorAlphaNum(&$form, $field, $type, $message) { parent::FormValidatorRegExp($form, $field, $type, $message, '/^[A-Z0-9]+([\\-_][A-Z0-9]+)*$/i'); }