Changeset 11361
- Timestamp:
- 09/07/08 19:18:05 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/widget/sfWidgetFormSchema.class.php
r11153 r11361 676 676 $this[$name] = $field; 677 677 } 678 foreach ($this->formFormatters as &$formFormatter) 679 { 680 $formFormatter = clone $formFormatter; 681 $formFormatter->setWidgetSchema($this); 682 } 678 683 } 679 684 } branches/1.1/lib/widget/sfWidgetFormSchemaFormatter.class.php
r9238 r11361 40 40 public function __construct(sfWidgetFormSchema $widgetSchema) 41 41 { 42 $this-> widgetSchema = $widgetSchema;42 $this->setWidgetSchema($widgetSchema); 43 43 } 44 44 … … 326 326 return $this->helpFormat; 327 327 } 328 329 public function setWidgetSchema($widgetSchema) 330 { 331 $this->widgetSchema = $widgetSchema; 332 } 328 333 } branches/1.1/test/unit/widget/sfWidgetFormSchemaTest.php
r11153 r11361 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(6 1, new lime_output_color());13 $t = new lime_test(63, new lime_output_color()); 14 14 15 15 $w1 = new sfWidgetFormInput(array(), array('class' => 'foo1')); … … 349 349 $t->diag('__clone()'); 350 350 $w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2)); 351 $format1 = new sfWidgetFormSchemaFormatterList($w); 352 $format1->setTranslationCatalogue('english'); 353 $w->addFormFormatter('testFormatter', $format1); 351 354 $w1 = clone $w; 352 355 $f1 = $w1->getFields(); … … 358 361 $t->ok($widget == $f[$name], '__clone() clones embedded widgets'); 359 362 } 363 $format1->setTranslationCatalogue('french'); 364 $formatters = $w1->getFormFormatters(); 365 $t->is(count($formatters), 1 , '__clone() returns a sfWidgetFormSchema that has the Formatters attached'); 366 $t->is($formatters['testFormatter']->getTranslationCatalogue(), 'english', '__clone() clones formatters, so that changes to the original one have no effect to the cloned formatter.'); 360 367 361 368 // setDefaultFormFormatterName()