2009年9月19日星期六

Re: [fw-mvc] PHPUnit testing generating Zend_Dom_Exception

-- Ian Munday <ian.munday@illumen.co.uk> wrote
(on Saturday, 19 September 2009, 04:34 PM +0100):
> I'm getting up and running with PHPUnit after following the video
> tutorial and other resources at
> http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/
>
> However, when using the methods assertQueryContentContains() or
> assertXpathContentContains(), I get the following exception:
>
> Zend_Dom_Exception: Error parsing document (type == docXml)
>
> Other methods such as assertModule(), assertController(), assertAction()
> and assertResponseCode() are working fine.
>
> Has anyone else encountered this, or have clues as to how to fix?

If you're getting an "error parsing document", then it's usually a
matter of ext/dom being unable to parse it. This most frequently happens
if you set the document as XML, but it has invalid markup. One thing to
note: DOMDocument::loadHTML() is typically *far* more forgiving of
markup errors than DOMDocument::loadXML() -- so make sure that if you're
claiming your document is XML or XHTML+XML that it's completely valid
XML markup.

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: