public function testRender() { $domDocument = new \DOMDocument(); $format = new Format(); $format->setBackgroundColor("some-bgcolor")->setStyle("some-style")->setTextSize(42)->setTextFont("some-textfont")->setTextColor("some-textcolor")->setAreaColor("some-areacolor")->setAreaFocusColor("some-areafocuscolor"); $domElement = $format->render($domDocument); $domDocument->appendChild($domElement); $this->assertEquals("<?xml version=\"1.0\"?>\n<format bgcolor=\"some-bgcolor\" style=\"some-style\" textsize=\"42\" textfont=\"some-textfont\" textcolor=\"some-textcolor\" focusareacolor1=\"some-areacolor\" focusareacolor2=\"some-areafocuscolor\"/>\n", $domDocument->saveXML()); }
/** * @see Renderable::render() */ public function render(\DOMDocument $domDocument) { $domElement = parent::render($domDocument); if ($this->format) { $formatXml = $this->format->render($domDocument); $domElement->appendChild($formatXml); } foreach ($this->children as $child) { $childXmlElement = $child->render($domDocument); $domElement->appendChild($childXmlElement); } return $domElement; }
/** * @see Renderable::render() */ public function render(\DOMDocument $domDocument) { $domElement = $domDocument->createElement("framemodel"); $domElement->setAttribute("id", $this->getId()); if ($this->format) { $formatElement = $this->format->render($domDocument); $domElement->appendChild($formatElement); } foreach ($this->children as $child) { $childElement = $child->render($domDocument); $domElement->appendChild($childElement); } return $domElement; }