Changeset 5936
- Timestamp:
- 01/14/12 19:51:31 (4 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
core/viewhelper/form/form.php (modified) (1 diff)
-
tests/unittests/core/viewhelper/form/form.core.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/viewhelper/form/form.php
r5934 r5936 638 638 * Shortcut to set the Legend text of the fieldset decorator. 639 639 * 640 * The legend belongs to the fieldset decorator.640 * The legend tag belongs to the fieldset decorator. 641 641 * The fieldset decorator is a default decorator instantiated, when rendering the form. 642 642 * It does not exist at the time of form definition. 643 * So we keep the legend value till the fieldset decorator is instantiated. 644 * Then the decorator attributes array is automatically set applied to the form and it's objects. 645 * 646 * Note: you can use the long form anytime, when defining your form. 647 * 648 * @param string String for the legend of the fieldset. 643 * So we keep the legend value stored, till the fieldset decorator is instantiated. 644 * Then the decorator attributes array is automatically assigned to the form and it's objects. 645 * 646 * Note: you can use the long form (array notation) anytime, when defining your form. 647 * Though using method chaining is a bit nicer (fluent interface). 648 * 649 * @param string String for the legend tag of the fieldset. 650 * 651 * @return object Clansuite_Form 649 652 */ 650 653 public function setLegend($legend) 651 654 { 652 655 $this->setDecoratorAttributesArray(array('form' => array('fieldset' => array('legend' => $legend)))); 656 657 return $this; 653 658 } 654 659 -
trunk/tests/unittests/core/viewhelper/form/form.core.php
r5927 r5936 1 1 <?php 2 /** 3 * @todo method chaining tests on all setter methods 4 */ 2 5 class Clansuite_Form_Test extends Clansuite_UnitTestCase 3 6 { … … 7 10 protected $form; 8 11 9 public function markTestIncomplete($msg)10 {11 $this->assertTrue(false, $msg);12 }13 14 12 /** 15 13 * Sets up the fixture, for example, opens a network connection. … … 70 68 # set external url 71 69 $this->form->setAction('index.php?mod=news&action=show'); 72 $this->assertEqual( WWW_ROOT . 'index.php?mod =index.php%3Fmod%3Dnews%26action%3Dshow', $this->form->getAction());70 $this->assertEqual( WWW_ROOT . 'index.php?mod%3Dnews%26action%3Dshow', $this->form->getAction()); 73 71 } 74 72 … … 78 76 79 77 # via getter - qualified url 80 $this->assertEqual( WWW_ROOT . 'index.php?mod =index.php%3Fmod%3Dnews%26action%3Dshow', $this->form->getAction());78 $this->assertEqual( WWW_ROOT . 'index.php?mod%3Dnews%26action%3Dshow', $this->form->getAction()); 81 79 } 82 80 … … 294 292 # via getter - returns string 295 293 $this->assertEqual('legend-set', $this->form->getLegend()); 294 295 # allows method chaining 296 $this->assertEqual($this->form, $this->form->setLegend('returns form object')); 297 } 298 299 public function testSetLegend_allowsMethodChaining() 300 { 301 $return_value = $this->form->setLegend('returns form object'); 302 303 $this->assertIdentical($this->form, $return_value); 296 304 } 297 305
Note: See TracChangeset
for help on using the changeset viewer.
