示例#1
0
 public function testAddElement()
 {
     $this->factoryCollectionMock->expects($this->once())->method('create')->will($this->returnValue($this->allElementsMock));
     $this->elementMock->expects($this->once())->method('setForm');
     $this->allElementsMock->expects($this->once())->method('add')->with($this->elementMock, false);
     $this->abstractForm->addElement($this->elementMock, false);
 }
 /**
  * Add form element
  *
  * @param AbstractElement $element
  * @param bool $after
  * @return Form
  */
 public function addElement(AbstractElement $element, $after = false)
 {
     if ($this->getForm()) {
         $this->getForm()->checkElementId($element->getId());
         $this->getForm()->addElementToCollection($element);
     }
     parent::addElement($element, $after);
     return $this;
 }