예제 #1
0
파일: start.php 프로젝트: raftalks/former
 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');
 }
예제 #2
0
 /**
  * Add values to populate the array
  *
  * @param mixed $values Can be an Eloquent object or an array
  * @static 
  */
 public static function populate($values)
 {
     return \Former\Former::populate($values);
 }
예제 #3
0
 public function testNoPopulatingPasswords()
 {
     Former::populate(array('foo' => 'bar'));
     $populate = Former::password('foo')->__toString();
     $matcher = $this->cg('<input type="password" name="foo" id="foo">');
     $this->assertEquals($matcher, $populate);
 }
예제 #4
0
 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);
 }
예제 #5
0
 public function testRepopulateFromModel()
 {
     Former::populate((object) array('foo' => 0));
     $radios = Former::radios('foo')->radios('foo', 'bar')->__toString();
     $matcher = $this->cgm($this->rc('foo', 'Foo', 0) . $this->r('foo2', 'Bar', 1));
     $this->assertEquals($matcher, $radios);
 }
예제 #6
0
 public function testNestedRelationships()
 {
     for ($i = 0; $i < 2; $i++) {
         $bar[] = (object) array('id' => $i, 'kal' => 'val' . $i);
     }
     $foo = (object) array('bar' => $bar);
     Former::populate($foo);
     $select = Former::select('bar.kal')->__toString();
     $matcher = $this->cg('<select id="bar.kal" name="bar.kal"><option value="0">val0</option><option value="1">val1</option></select>', '<label for="bar.kal" class="control-label">Bar.kal</label>');
     $this->assertEquals($matcher, $select);
 }