/** * Test rendering a div with HTML tidy. * @depends testRender_withSubdivs */ public function testRender_tidy() { if (!class_exists('tidy')) { $this->markTestSkipped("Tidy extension not available"); } $html = <<<HTML <div> <div> Test </div> <div class="subdiv"> <div> Child </div> <p> foobar </p> </div> </div> HTML; $this->div->setOption('tidy', array('indent' => true)); $this->div->add('<div>Test</div>'); $child = new Div(array('class' => 'subdiv')); $child->add('<div>Child</div>'); $this->div->add($child); $element = $this->getMockBuilder('Jasny\\FormBuilder\\Element')->getMockForAbstractClass(); $element->expects($this->once())->method('render')->will($this->returnValue('<p>foobar</p>')); $child->add($element); $this->assertSame($html, (string) $this->div); }