Changeset 11622
- Timestamp:
- 09/17/08 20:47:31 (1 year ago)
- Files:
-
- branches/1.2/lib/form/sfForm.class.php (modified) (4 diffs)
- branches/1.2/test/unit/form/sfFormTest.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/form/sfForm.class.php
r11545 r11622 4 4 * This file is part of the symfony package. 5 5 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 269 269 throw new LogicException('A bound form cannot be embedded'); 270 270 } 271 271 272 272 $form = clone $form; 273 273 unset($form[self::$CSRFFieldName]); … … 333 333 334 334 /** 335 * Merges current form widget and validator schemas with the ones from the 336 * sfForm object passed as parameter 335 * Merges current form widget and validator schemas with the ones from the 336 * sfForm object passed as parameter. Please note it also merge defaults. 337 337 * 338 338 * @param sfForm $form The sfForm instance to merge with current form 339 * 339 340 * @throws LogicException If one of the form has already been bound 340 341 */ … … 360 361 $this->validatorSchema[$field] = $validator; 361 362 } 363 364 $this->getWidgetSchema()->setLabels(array_merge($this->getWidgetSchema()->getLabels(), 365 $form->getWidgetSchema()->getLabels())); 362 366 363 367 $this->mergePreValidator($form->getValidatorSchema()->getPreValidator()); branches/1.2/test/unit/form/sfFormTest.php
r11565 r11622 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(10 2, new lime_output_color());13 $t = new lime_test(103, new lime_output_color()); 14 14 15 15 class FormTest extends sfForm … … 576 576 'c' => new sfValidatorString(array('max_length' => 1000)), 577 577 )); 578 $this->getWidgetSchema()->setLabels(array( 579 'a' => '1_a', 580 'b' => '1_b', 581 'c' => '1_c', 582 )); 578 583 } 579 584 } … … 592 597 'd' => new sfValidatorString(array('max_length' => 5)), 593 598 )); 599 $this->getWidgetSchema()->setLabels(array( 600 'c' => '2_c', 601 'd' => '2_d', 602 )); 594 603 $this->validatorSchema->setPreValidator(new sfValidatorPass()); 595 604 $this->validatorSchema->setPostValidator(new sfValidatorPass()); … … 607 616 $t->is(array_keys($widgetSchema->getFields()), array('a', 'b', 'c', 'd'), 'mergeForms() merges the correct widgets'); 608 617 $t->is(array_keys($validatorSchema->getFields()), array('a', 'b', 'c', 'd'), 'mergeForms() merges the correct validators'); 618 $t->is($widgetSchema->getLabels(), array('a' => '1_a', 'b' => '1_b', 'c' => '2_c', 'd' => '2_d'), 'mergeForm() merges labels correctly'); 609 619 $t->isa_ok($widgetSchema['c'], 'sfWidgetFormTextarea', 'mergeForm() overrides original form widget'); 610 620 $t->isa_ok($validatorSchema['c'], 'sfValidatorPass', 'mergeForm() overrides original form validator');

