public function testCanGroupCheckboxes() { Former::framework(null); $auto = Former::checkboxes('value[]', '')->checkboxes('Value 01', 'Value 02')->__toString(); $chain = Former::checkboxes('value', '')->grouped()->checkboxes('Value 01', 'Value 02')->__toString(); $this->assertEquals($chain, $auto); $this->assertEquals('<label for="value_0" class="checkbox">' . '<input id="value_0" type="checkbox" name="value[]" value="1">Value 01' . '</label>' . '<label for="value_1" class="checkbox">' . '<input id="value_1" type="checkbox" name="value[]" value="1">Value 02' . '</label>', $auto); }
public function testMultipleCustom() { $checkboxes = Former::checkboxes('foo')->checkboxes(array('foo' => 'Foo', 'bar' => 'Bar'))->__toString(); $matcher = $this->cg($this->cb('foo', 'Foo') . $this->cx('bar', 'Bar')); $this->assertEquals($matcher, $checkboxes); }
public function testRepopulateFromModel() { Former::populate((object) array('foo_0' => true)); $checkboxes = Former::checkboxes('foo')->checkboxes('foo', 'bar')->__toString(); $matcher = $this->cgm($this->cbc('foo_0', 'Foo') . $this->cb('foo_1', 'Bar')); $this->assertEquals($matcher, $checkboxes); }