Exemple #1
0
 public function testTextWithoutLabel()
 {
     Former::config('automatic_label', false);
     $input = Former::text('foo')->__toString();
     $matcher = $this->cg('<input type="text" name="foo" id="foo">', null);
     $this->assertEquals($matcher, $input);
 }
Exemple #2
0
 public function setUp()
 {
     Input::clear();
     \Former\Former::horizontal_open();
     \Former\Former::populate(array());
     \Former\Former::withErrors(null);
     \Former\Former::config('automatic_label', true);
     \Former\Former::config('push_checkboxes', false);
     \Former\Former::framework('bootstrap');
 }
Exemple #3
0
 public function testCustomUncheckedValue()
 {
     Former::config('push_checkboxes', true);
     Former::config('unchecked_value', 'unchecked');
     $checkbox = Former::checkbox('foo')->text('foo')->__toString();
     $matcher = $this->cg('<label for="foo" class="checkbox">' . '<input type="hidden" name="foo" value="unchecked" id="foo">' . $this->cb('foo') . 'Foo' . '</label>');
     $this->assertEquals($matcher, $checkbox);
     Former::config('push_checkboxes', false);
 }
Exemple #4
0
 public function testChangeViaFormerOptions()
 {
     Former::config('framework', 'zurb');
     $this->assertEquals(Framework::current(), 'zurb');
 }
Exemple #5
0
 public function testDisablingValidation()
 {
     Former::config('live_validation', false);
     Former::withRules(array('foo' => 'required'));
     $input = Former::text('foo')->__toString();
     $matcher = $this->cg($this->field(), '<label for="foo" class="control-label">Foo</label>');
     $this->assertEquals($matcher, $input);
 }