check() public method

public check ( )
 public function testDefaultToUnchecked()
 {
     $checkbox = new Checkbox('above_18');
     $expected = '<input type="checkbox" name="above_18" value="1">';
     $result = $checkbox->defaultToUnchecked()->render();
     $this->assertEquals($expected, $result);
     $checkbox = new Checkbox('above_18');
     $expected = '<input type="checkbox" name="above_18" value="1" checked="checked">';
     $result = $checkbox->defaultToUnchecked()->check()->render();
     $this->assertEquals($expected, $result);
     $checkbox = new Checkbox('above_18');
     $expected = '<input type="checkbox" name="above_18" value="1" checked="checked">';
     $result = $checkbox->check()->defaultToUnchecked()->render();
     $this->assertEquals($expected, $result);
 }
Beispiel #2
0
 public function checkbox($name, $value = 1)
 {
     $checkbox = new Checkbox($name, $value);
     $oldValue = $this->getValueFor($name);
     if ($value == $oldValue) {
         $checkbox->check();
     }
     return $checkbox;
 }