Development

Changeset 5949

You must first sign up to be able to contribute.

Changeset 5949

Show
Ignore:
Timestamp:
11/10/07 13:56:46 (6 years ago)
Author:
fabien
Message:

fixed sfValidatorSchema when the input array does not contain values for all fields (needed to be able to validate checkboxes for example)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/validator/sfValidatorSchema.class.php

    r5882 r5949  
    164164      try 
    165165      { 
    166         $this->fields[$name]->clean(null); 
     166        $clean[$name] = $this->fields[$name]->clean(null); 
    167167      } 
    168168      catch (sfValidatorError $e) 
  • trunk/test/unit/validator/sfValidatorSchemaTest.php

    r5816 r5949  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(43, new lime_output_color()); 
     13$t = new lime_test(44, new lime_output_color()); 
    1414 
    1515class PreValidator extends sfValidator 
     
    192192} 
    193193 
     194$v = new sfValidatorSchema(array('s1' => $v1, 's2' => $v2)); 
     195$t->is($v->clean(array('s1' => 'foo')), array('s1' => 'foo', 's2' => null), '->clean() returns null values for fields not present in the input array'); 
     196 
    194197$t->diag('extra fields'); 
    195198$v = new sfValidatorSchema(array('s1' => $v1, 's2' => $v2));