/**
  * Test rendering of a form element.
  */
 public function testRenderSingleElement()
 {
     $labelElement = new LabelElement('label', 'Label', 'text');
     $textElement = new TextElement('text');
     $container = new ElementContainer('text');
     $container->add($textElement);
     $formElement = new FormElement($container, $labelElement);
     $this->assertEquals('<label for="text" id="label">Label</label><input type="text" id="text" name="text"/>' . PHP_EOL, $formElement->render());
 }
 /**
  * @param AbstractHtmlElement $element
  * @param string $label
  * @param bool $preLabel
  * @return ElementContainer
  */
 private function getElementWithLabel(AbstractHtmlElement $element, $label, $preLabel = true)
 {
     $container = new ElementContainer($element->getId());
     $label = $this->getLabel('label_' . $element->getId(), $label, $element->getId());
     if ($preLabel) {
         $container->add($label, 'label');
     }
     $container->add($element, 'control');
     if (!$preLabel) {
         $container->add($label, 'label');
     }
     return $container;
 }