示例#1
0
 public function testRowWithValue()
 {
     $token = '12345';
     $this->row->setValue($token);
     $expected = Html::input('hidden', 'token', $token);
     $this->assertSame($expected, $this->row->render($this->renderer));
 }
示例#2
0
 public function testSimpleFormPassInRenderer()
 {
     $f = $this->createForm('/post/url', 'get');
     $row = new TextRow('foo');
     $f->addRow($row);
     $expected = Html::openTag('form', array('action' => '/post/url', 'method' => 'GET'));
     $this->renderer->expects($this->never())->method('row');
     $renderer = $this->getMock('Reform\\Form\\Renderer\\RendererInterface');
     $renderer->expects($this->once())->method('row')->with($row)->will($this->returnValue('row'));
     $expected .= 'row';
     $expected .= '</form>';
     $this->assertSame($expected, $f->render($renderer));
 }
示例#3
0
 /**
  * @dataProvider notSetAttributeAddProvider()
  */
 public function testAddToAttributeArrayNotSet($addition, $expected)
 {
     $attributes = array('id' => 'my-element');
     $expected = array('id' => 'my-element', 'class' => $expected);
     $this->assertSame($expected, Html::addToAttributeArray($attributes, 'class', $addition));
 }
示例#4
0
 public function input(RendererInterface $renderer)
 {
     return Html::input('hidden', $this->name, $this->value, $this->attributes);
 }
示例#5
0
 public function select($name, array $values, $selected = null, $multiple = false, array $attributes = array())
 {
     return Html::select($name, $values, $selected, $multiple, $attributes);
 }
示例#6
0
 public function select($name, array $values, $selected = null, $multiple = false, array $attributes = array())
 {
     $attributes = Html::addToAttributeArray($attributes, 'class', 'form-control');
     return Html::select($name, $values, $selected, $multiple, $attributes);
 }
示例#7
0
 /**
  * Render the header of this Form as Html.
  */
 public function header()
 {
     $attributes = array('action' => $this->action, 'method' => $this->method);
     $attributes = array_merge($attributes, $this->attributes);
     return Html::openTag('form', $attributes);
 }
示例#8
0
 public function input(RendererInterface $renderer)
 {
     $attributes = $this->visible ? $this->attributes : array_merge(array('style' => 'display: none;'), $this->attributes);
     return Html::input('text', $this->name, $this->value, $attributes);
 }