Development

Changeset 7154

You must first sign up to be able to contribute.

Changeset 7154

Show
Ignore:
Timestamp:
01/22/08 15:32:58 (10 months ago)
Author:
fabien
Message:

fixed sfForm::renderGlobalErrors() and added unit tests for the method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/form/sfForm.class.php

    r7152 r7154  
    113113  public function renderGlobalErrors() 
    114114  { 
    115     return $this->widgetSchema->getFormFormatter()->formatErrorRow($this->widgetSchema->getGlobalErrors($this->getErrorSchema())); 
     115    return $this->widgetSchema->getFormFormatter()->formatErrorsForRow($this->widgetSchema->getGlobalErrors($this->getErrorSchema())); 
    116116  } 
    117117 
  • branches/1.1/test/unit/form/sfFormTest.php

    r7124 r7154  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(84, new lime_output_color()); 
     13$t = new lime_test(85, new lime_output_color()); 
    1414 
    1515class FormTest extends sfForm 
     
    221221$t->is($f->getErrorSchema()->getCode(), '1 [min_length] file [max_size]', '->bind() behaves correctly with files'); 
    222222 
     223// ->renderGlobalErrors() 
     224$t->diag('->renderGlobalErrors()'); 
     225$f = new FormTest(); 
     226$f->setValidatorSchema(new sfValidatorSchema(array( 
     227  'id'         => new sfValidatorInteger(), 
     228  'first_name' => new sfValidatorString(array('min_length' => 2)), 
     229  'last_name'  => new sfValidatorString(array('min_length' => 2)), 
     230))); 
     231$f->setWidgetSchema(new sfWidgetFormSchema(array( 
     232  'id'         => new sfWidgetFormInputHidden(), 
     233  'first_name' => new sfWidgetFormInput(), 
     234  'last_name'  => new sfWidgetFormInput(), 
     235))); 
     236$f->bind(array( 
     237  'id'         => 'dddd', 
     238  'first_name' => 'f', 
     239  'last_name'  => 'potencier', 
     240)); 
     241$output = <<<EOF 
     242  <ul class="error_list"> 
     243    <li>Id: "dddd" is not an integer.</li> 
     244  </ul> 
     245 
     246EOF; 
     247$t->is($f->renderGlobalErrors(), $output, '->renderGlobalErrors() renders global errors as an HTML list'); 
     248 
    223249// ->embedForm() 
    224250$t->diag('->embedForm()');