public function testRender() { $domDocument = new \DOMDocument(); $frameModel = new FrameModel(); $frameModel->setId("model-id")->addChild(new Including())->setFormat(new Format()); $domElement = $frameModel->render($domDocument); $domDocument->appendChild($domElement); $this->assertEquals($domDocument->saveXML(), "<?xml version=\"1.0\"?>\n<framemodel id=\"model-id\"><format/><include/></framemodel>\n"); }
/** * @see Renderable::render() */ public function render(\DOMDocument $domDocument) { $domElement = parent::render($domDocument); if ($this->model) { $this->model->checkId(); $domElement->setAttribute("modelid", $this->model->getId()); } else { if ($this->modelId) { $domElement->setAttribute("modelid", $this->modelId); } } return $domElement; }