public function testRowWithValue() { $token = '12345'; $this->row->setValue($token); $expected = Html::input('hidden', 'token', $token); $this->assertSame($expected, $this->row->render($this->renderer)); }
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)); }
/** * @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)); }
public function input(RendererInterface $renderer) { return Html::input('hidden', $this->name, $this->value, $this->attributes); }
public function select($name, array $values, $selected = null, $multiple = false, array $attributes = array()) { return Html::select($name, $values, $selected, $multiple, $attributes); }
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); }
/** * 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); }
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); }