/** * toString * * @param bool $forcePair * * @return string */ public function toString($forcePair = false) { $tmpContent = clone $this->getContent(); $tmpName = $this->getAttribute('name'); $this->prepareOptions(); if ($this->multiple) { $this->setAttribute('name', $this->getAttribute('name') . '[]'); } $html = parent::toString($forcePair); $this->setAttribute('name', $tmpName); $this->setContent($tmpContent); return $html; }
/** * Method to test create(). * * @param string $name * @param string $expect * @param string $tag * @param string $content * @param array $attribs * @param boolean $forcePaired * * @return void * * @covers Windwalker\Dom\Builder\HtmlBuilder::create * * @dataProvider domTestCase */ public function testCreate($name, $expect, $tag, $content, $attribs, $forcePaired) { $element = new HtmlElement($tag, $content, $attribs, $forcePaired); $this->assertEquals(DomHelper::minify($expect), DomHelper::minify($element->toString($forcePaired)), 'Dom build case fail: ' . $name); }