Files
yii/tests/framework/validators/ValidatorTestModel.php
Carsten Brandt a2aa6ee648 Merge pull request #2354 branch '2343-required-validator-trim' of https://github.com/AnatolyRugalev/yii into AnatolyRugalev-2343-required-validator-trim
* '2343-required-validator-trim' of https://github.com/AnatolyRugalev/yii:
  changed changelog line
  Added @since for $trim property
  Modified changelog line
  Added changelog line
  Added CRequiredValidator test case for $trim => true
  Added CRequiredValidator test
  Added $trim property to CRequiredValidator

Conflicts:
	tests/framework/validators/ValidatorTestModel.php
2013-04-17 19:17:08 +02:00

38 lines
1.0 KiB
PHP

<?php
class ValidatorTestModel extends CFormModel
{
public $string1;
public $string2;
public $string3;
public $email;
public $url;
public $number;
public $username;
public $address;
public function rules()
{
return array(
array('string1', 'length', 'min'=>10, 'tooShort'=>'Too short message.', 'allowEmpty'=>false,
'on'=>'CStringValidatorTest'),
array('string2', 'length', 'max'=>10, 'tooLong'=>'Too long message.', 'allowEmpty'=>false,
'on'=>'CStringValidatorTest'),
array('string3', 'length', 'is'=>10, 'message'=>'Error message.', 'allowEmpty'=>false,
'on'=>'CStringValidatorTest'),
array('email', 'email', 'allowEmpty'=>false, 'on'=>'CEmailValidatorTest'),
array('url', 'url', 'allowEmpty'=>false, 'on'=>'CUrlValidatorTest'),
array('number', 'numerical', 'min'=>5, 'max'=>15, 'integerOnly'=>true, 'on'=>'CNumberValidatorTest'),
array('username', 'required', 'trim' => false, 'on' => 'CRequiredValidatorTest'),
array('address', 'required', 'on' => 'CRequiredValidatorTest'),
);
}
}