public function renderBeginTag($tagName) { $str = '<' . $tagName; foreach ($this->_attributes as $name => $value) { $str .= ' ' . $name . '="' . $value . '"'; } if (!empty($this->_styles)) { $str .= ' style="'; foreach ($this->_styles as $name => $value) { $str .= $name . ':' . $value . ';'; } $str .= '"'; } if (isset(self::$_simpleTags[$tagName])) { $str .= ' />'; $this->_openTags[] = ''; } else { $str .= '>'; $this->_openTags[] = $tagName; } $this->_writer->write($str); $this->_attributes = array(); $this->_styles = array(); }
public function testRenderEndTag() { $writer = new THtmlWriter(self::$output); $writer->renderBeginTag('div'); $writer->write('Div Content'); $writer->renderEndTag(); self::assertEquals('<div>Div Content</div>', self::$output->flush()); }