Example #1
0
 function testCheckboxGroupRender()
 {
     $el = new Element\Checkbox('age');
     $el->setOptions(array(10 => 'Десять', 20 => 'Двадцать', 30 => 'Тридцать'));
     $el->setDefaultValue(array(10, 30));
     $exp = '<label><input checked="checked" name="age[]" type="checkbox" value="10" /> Десять</label>' . "\n" . '<label><input name="age[]" type="checkbox" value="20" /> Двадцать</label>' . "\n" . '<label><input checked="checked" name="age[]" type="checkbox" value="30" /> Тридцать</label>' . "\n";
     $this->assertEquals($exp, $el->render()->toHTML(), 'Список checkbox');
 }
Example #2
0
 /** @return Element\Checkbox */
 public function addCheckbox($field, $name = null, array $options = null)
 {
     $el = new Element\Checkbox($field, $name, $this);
     if ($options) {
         $el->setOptions($options);
     }
     $this->add($el);
     return $el;
 }