Exemplo n.º 1
0
 /**
  * @covers Xoops\Form\Checkbox::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
 }
 public function testCheckbox()
 {
     $checkbox = new Checkbox(['name' => "name", 'checked' => 'checked']);
     $this->assertEquals($checkbox->render(), '<div><input name="name" type="checkbox" /></div>');
 }
/**
 * Checkbox getter Function
 * @see checkbox()
 * @ignore
 */
function get_checkbox($name, $value, $label = FALSE, $args = array())
{
    $checkbox = new Checkbox($name, $value, $label, $args);
    return $checkbox->render();
}
Exemplo n.º 4
0
 /**
  * @covers Xoops\Form\Checkbox::__construct
  * @covers Xoops\Form\Checkbox::render
  * @covers Xoops\Form\Checkbox::renderValidationJS
  */
 public function test__construct()
 {
     $oldWay = new Checkbox('mycaption', 'myname', 'opt1');
     $oldWay->addOption('opt1', 'optname1');
     $oldWay->addOption('opt2', 'optname2');
     $oldWay->setRequired();
     $newWay = new Checkbox(['caption' => 'mycaption', 'name' => 'myname', 'value' => 'opt1', 'required' => null, 'option' => ['opt1' => 'optname1', 'opt2' => 'optname2']]);
     $this->assertEquals($oldWay->render(), $newWay->render());
     $this->assertEquals($oldWay->renderValidationJS(), $newWay->renderValidationJS());
 }