Пример #1
0
 public function testSettingNameSetsNameAttribute()
 {
     $element = new Element();
     $element->setName('foo');
     $this->assertEquals('foo', $element->getAttribute('name'));
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function setName($name)
 {
     return $this->element->setName($name);
 }
Пример #3
0
 public function testEnsureUseHiddenElementMethodExists()
 {
     $element = new Element();
     $element->setName('codeType');
     $element->setOptions(array('label' => 'Code Type'));
     $element->setAttributes(array('type' => 'radio', 'options' => array('Markdown' => 'markdown', 'HTML' => 'html', 'Wiki' => 'wiki'), 'value' => array('markdown')));
     $markup = $this->helper->render($element);
     $this->assertNotContains('type="hidden"', $markup);
     // Lack of error also indicates this test passes
 }
Пример #4
0
 /**
  *
  * @param type $strName
  * @param type $arrAttributes
  * @param type $arrOptions
  * @param ElementZend $objectElement
  * @return ElementZend|boolean
  */
 private function prepareElementDefault($strName, $arrAttributes, $arrOptions, ElementZend $objectElement)
 {
     if (func_num_args() == 1) {
         $arrElement = $this->getElementDefault(func_get_args());
         if (!is_array($arrElement)) {
             return false;
         }
         extract($arrElement);
     } else {
         if (empty($arrAttributes)) {
             $arrAttributes = array();
         }
         if (empty($arrOptions)) {
             $arrOptions = array();
         }
     }
     $objectElement->setName($strName)->setOptions($arrOptions)->setAttributes($arrAttributes);
     return $objectElement;
 }