Esempio n. 1
0
 public function testDefaultToUnchecked()
 {
     $checkbox = new RadioButton('above_18');
     $expected = '<input type="radio" name="above_18" value="above_18">';
     $result = $checkbox->defaultToUnchecked()->render();
     $this->assertEquals($expected, $result);
     $checkbox = new RadioButton('above_18');
     $expected = '<input type="radio" name="above_18" value="above_18" checked="checked">';
     $result = $checkbox->defaultToUnchecked()->check()->render();
     $this->assertEquals($expected, $result);
     $checkbox = new RadioButton('above_18');
     $expected = '<input type="radio" name="above_18" value="above_18" checked="checked">';
     $result = $checkbox->check()->defaultToUnchecked()->render();
     $this->assertEquals($expected, $result);
 }
Esempio n. 2
0
 public function radio($name, $value = null)
 {
     $value = is_null($value) ? $name : $value;
     $radio = new RadioButton($name, $value);
     $oldValue = $this->getValueFor($name);
     if ($value == $oldValue) {
         $radio->check();
     }
     return $radio;
 }