rules() public méthode

public rules ( ) : array
Résultat array
Exemple #1
0
 public function testWithBehavior()
 {
     $form = new LoginForm();
     $formAttributes = $form->attributeNames();
     $formRules = $form->rules();
     $formLabels = $form->attributeLabels();
     $form->attachBehavior('captcha', array('class' => 'CaptchaFormBehavior'));
     $behaviorAttributes = $form->asa('captcha')->attributeNames();
     $behaviorRules = $form->asa('captcha')->filterRules();
     $behaviorLabels = $form->asa('captcha')->attributeLabels();
     $this->assertEquals(array_merge($formAttributes, $behaviorAttributes), $form->attributeNames());
     $this->assertEquals(array_merge($formRules, $behaviorRules), $form->rules());
     $this->assertEquals(array_merge($formLabels, $behaviorLabels), $form->attributeLabels());
     $form->detachBehavior('captcha');
     $this->assertEquals($formAttributes, $form->attributeNames());
     $this->assertEquals($formAttributes, $form->attributeNames());
 }
Exemple #2
0
 /**
  * Declares the validation rules.
  * The rules state that username and password are required,
  * and password needs to be authenticated.
  */
 public function rules()
 {
     return array_merge(parent::rules(), array());
 }