Development

Changeset 24278

You must first sign up to be able to contribute.

Changeset 24278

Show
Ignore:
Timestamp:
11/23/09 16:21:09 (3 years ago)
Author:
Kris.Wallsmith
Message:

[1.3, 1.4] added getOptions method to sfForm (closes #7613)

Files:

Legend:

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

    r23214 r24278  
    735735 
    736736  /** 
     737   * Returns the current form's options. 
     738   * 
     739   * @return array The current form's options 
     740   */ 
     741  public function getOptions() 
     742  { 
     743    return $this->options; 
     744  } 
     745 
     746  /** 
    737747   * Sets an option value. 
    738748   * 
  • branches/1.3/test/unit/form/sfFormTest.php

    r23994 r24278  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(154); 
     13$t = new lime_test(155); 
    1414 
    1515class FormTest extends sfForm 
     
    106106$t->ok($f->isCSRFProtected(), '__construct() uses CSRF protection if null is passed as the second argument and it\'s enabled globally'); 
    107107 
    108 // ->getOption() ->setOption() 
     108// ->getOption() ->setOption() ->getOptions() 
    109109$t->diag('->getOption() ->setOption()'); 
    110110$f = new FormTest(array(), array('foo' => 'bar')); 
     
    112112$f->setOption('bar', 'foo'); 
    113113$t->is($f->getOption('bar'), 'foo', '->setOption() changes the value of an option'); 
     114$t->is_deeply($f->getOptions(), array('foo' => 'bar', 'bar' => 'foo'), '->getOptions() returns all options'); 
    114115 
    115116sfForm::disableCSRFProtection(); 
  • branches/1.4/lib/form/sfForm.class.php

    r23214 r24278  
    735735 
    736736  /** 
     737   * Returns the current form's options. 
     738   * 
     739   * @return array The current form's options 
     740   */ 
     741  public function getOptions() 
     742  { 
     743    return $this->options; 
     744  } 
     745 
     746  /** 
    737747   * Sets an option value. 
    738748   * 
  • branches/1.4/test/unit/form/sfFormTest.php

    r23994 r24278  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(154); 
     13$t = new lime_test(155); 
    1414 
    1515class FormTest extends sfForm 
     
    106106$t->ok($f->isCSRFProtected(), '__construct() uses CSRF protection if null is passed as the second argument and it\'s enabled globally'); 
    107107 
    108 // ->getOption() ->setOption() 
     108// ->getOption() ->setOption() ->getOptions() 
    109109$t->diag('->getOption() ->setOption()'); 
    110110$f = new FormTest(array(), array('foo' => 'bar')); 
     
    112112$f->setOption('bar', 'foo'); 
    113113$t->is($f->getOption('bar'), 'foo', '->setOption() changes the value of an option'); 
     114$t->is_deeply($f->getOptions(), array('foo' => 'bar', 'bar' => 'foo'), '->getOptions() returns all options'); 
    114115 
    115116sfForm::disableCSRFProtection();