I'm new to PHPUnit, and I'm having some trouble with unit testing HTML output.

My test follows:

/**
* @covers Scrap::removeTags
*
*/
public function testRemoveTags() {

    // Variables
    $simple_parameter        = 'script';
    $array_parameter         = array('script', 'div');
    $html                    = '<div class="pubanunciomrec" style="background:#FFFFFF;"><script type="text/javascript"><!-- google_ad_slot = "9853257829"; google_ad_width = 300; google_ad_height = 250; //--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div><table></table>';

    // Expected HTML
    $expected_html_whitout_script     = new DOMDocument;
    $expected_html_whitout_script->loadHTML('<div class="pubanunciomrec" style="background:#FFFFFF;"></div><table></table>');
    $expected_html_without_script_div = new DOMDocument;
    $expected_html_without_script_div->loadHTML('<table></table>');

    // Actual HTML
    $actual_whitout_script     = new DOMDocument;
    $actual_whitout_script->loadHTML($this->scrap->removeTags($html, $simple_parameter));
    $actual_without_script_div = new DOMDocument;
    $actual_without_script_div->loadHTML($this->scrap->removeTags($html, $array_parameter));


    // Test
    $this->assertEquals($expected_html_whitout_script, $actual_whitout_script);
    $this->assertEquals($expected_html_without_script_div, $actual_without_script_div);

}

My problem is that the DOMDocument object generates some HTML code and I can't compare it. How can I print the DOMDocument object to see the output? Any clues on how to compare the HTML?

Sorry for my bad english.

Best Regards,

Edit
Report