Development

Changeset 5642

You must first sign up to be able to contribute.

Changeset 5642

Show
Ignore:
Timestamp:
10/23/07 17:39:27 (1 year ago)
Author:
fabien
Message:

moved required/trim flags to the main validator for sfValidatorAll and sfValidatorAny

Files:

Legend:

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

    r5632 r5642  
    8686   * @see sfValidator 
    8787   */ 
    88   public function clean($value) 
    89   { 
    90     return $this->doClean($value); 
    91   } 
    92  
    93   /** 
    94    * @see sfValidator 
    95    */ 
    9688  protected function doClean($value) 
    9789  { 
  • trunk/lib/validator/sfValidatorAny.class.php

    r5632 r5642  
    8686   * @see sfValidator 
    8787   */ 
    88   public function clean($value) 
    89   { 
    90     return $this->doClean($value); 
    91   } 
    92  
    93   /** 
    94    * @see sfValidator 
    95    */ 
    9688  protected function doClean($value) 
    9789  { 
  • trunk/test/unit/validator/sfValidatorAllTest.php

    r5632 r5642  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(12, new lime_output_color()); 
     13$t = new lime_test(14, new lime_output_color()); 
    1414 
    1515$v1 = new sfValidatorString(array('max_length' => 3)); 
     
    4747$t->is($v->clean('foo'), 'foo', '->clean() returns the string unmodified'); 
    4848 
     49try 
     50{ 
     51  $v->clean(null); 
     52  $t->fail('->clean() throws an sfValidatorError exception if the input value is required'); 
     53  $t->skip('', 1); 
     54} 
     55catch (sfValidatorError $e) 
     56{ 
     57  $t->pass('->clean() throws an sfValidatorError exception if the input value is required'); 
     58  $t->is($e->getCode(), 'required', '->clean() throws a sfValidatorError'); 
     59} 
     60 
    4961$v2->setOption('max_length', 2); 
    5062try 
  • trunk/test/unit/validator/sfValidatorAnyTest.php

    r5632 r5642  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(14, new lime_output_color()); 
     13$t = new lime_test(16, new lime_output_color()); 
    1414 
    1515$v1 = new sfValidatorString(array('max_length' => 3)); 
     
    4747$t->is($v->clean('foo'), 'foo', '->clean() returns the string unmodified'); 
    4848 
     49try 
     50{ 
     51  $v->clean(null); 
     52  $t->fail('->clean() throws an sfValidatorError exception if the input value is required'); 
     53  $t->skip('', 1); 
     54} 
     55catch (sfValidatorError $e) 
     56{ 
     57  $t->pass('->clean() throws an sfValidatorError exception if the input value is required'); 
     58  $t->is($e->getCode(), 'required', '->clean() throws a sfValidatorError'); 
     59} 
     60 
    4961$v1->setOption('max_length', 1); 
    5062$v2->setOption('min_length', 5);