public function __construct($name = null, $attributes = null, array $data = array()) { parent::__construct($name, $attributes, $data); if (!$this->getAttribute('value')) { $this->setAttribute('value', 1); } }
public function testFrozenHtmlGeneration() { $checkable = new HTML_QuickForm2_Element_InputCheckable('checkableFreeze', array('value' => 'my value'), array('content' => 'freeze me')); $checkable->setAttribute('checked'); $checkable->toggleFrozen(true); $this->assertRegExp('!<input[^>]*type="hidden"[^>]*/>!', $checkable->__toString()); $checkable->removeAttribute('checked'); $this->assertNotRegExp('!<input!', $checkable->__toString()); }