Ejemplo n.º 1
0
 /**
  * @covers Xoops\Form\Hidden::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
     $this->assertTrue(false !== strpos($value, '<input'));
     $this->assertTrue(false !== strpos($value, 'type="hidden"'));
 }
 public function testInput()
 {
     $hidden = new Hidden(['name' => "name", 'value' => "Valor"]);
     $this->assertEquals($hidden->render(), '<div><input value="Valor" name="name" type="hidden" /></div>');
 }
Ejemplo n.º 3
0
 /**
  * @covers Xoops\Form\Hidden::__construct
  * @covers Xoops\Form\Hidden::render
  */
 public function test__construct()
 {
     $oldWay = new Hidden('myname', 'myvalue');
     $newWay = new Hidden(['name' => 'myname', 'value' => 'myvalue']);
     $this->assertEquals($oldWay->render(), $newWay->render());
 }
Ejemplo n.º 4
0
 /** @test */
 public function it_passses_the_label_as_value()
 {
     $field = new Hidden('test', 'test');
     $field->render();
     $this->assertSame('test', $field->getValue());
 }
 protected function renderElement()
 {
     $html = array();
     if (empty($this->uploaded_file)) {
         $attr = array('name' => $this->name, 'id' => $this->getDOMId(), 'class' => 'form-control');
         $html[] = '	<input type="file" ' . $this->serialiseAttributes($attr) . '/>';
     } else {
         $hidden = new Hidden($this->name, $this->label);
         $hidden->setValue($this->uploaded_file . '||' . $this->filename);
         $html[] = $hidden->render();
         $html[] = '	<label>' . $this->label . '</label>';
         $html[] = '	<p class="form-control-static">';
         $html[] = '		' . System::getLanguage()->_('MessageFileAlreadySelected');
         $html[] = '	</p>';
     }
     return implode("\n", $html);
 }
Ejemplo n.º 6
0
 public static function hidden($text, $value, array $attributes = array())
 {
     $control = new Hidden($text, $value, $attributes);
     $control->setEscaper(self::$escaper);
     echo $control->render();
 }