/** * Method to test __toString(). * * @return void * * @covers Windwalker\Dom\DomElements::__toString */ public function test__toString() { $expect = <<<DOM <p>foo</p> <table> \t<tr> \t\t<td>bar</td> \t</tr> </table> <div id="fly">yoo</div> DOM; $this->assertEquals(DomHelper::minify($expect), DomHelper::minify($this->instance)); }
/** * testToString * * @return void * * @covers Windwalker\Html\Option::toString * */ public function testToString() { $this->assertEquals(DomHelper::minify('<option class="item" value="sakura">flower</option>'), DomHelper::minify($this->instance)); }
/** * 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\DomBuilder::create * * @dataProvider domTestCase */ public function testCreate($name, $expect, $tag, $content, $attribs, $forcePaired) { $this->assertEquals(DomHelper::minify($expect), DomHelper::minify(DomBuilder::create($tag, $content, $attribs, $forcePaired)), 'Dom build case fail: ' . $name); }
/** * Method to test offsetUnset(). * * @return void * * @covers Windwalker\Dom\DomElement::offsetUnset */ public function testOffsetUnset() { $element = new DomElement('field', 'data', array('id' => 'foo')); unset($element['id']); $this->assertEquals(DomHelper::minify('<field>data</field>'), DomHelper::minify($element)); }
/** * 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); }
/** * Method to test getIterator(). * * @return void * * @covers Windwalker\Dom\DomElements::getIterator */ public function testGetIterator() { $iterator = $this->instance->getIterator(); $this->assertInstanceOf('ArrayIterator', $iterator); $this->assertEquals(DomHelper::minify('<option>foo</option>'), DomHelper::minify($iterator[0])); }