Page 1 of 1

PHPTD - Testing XML

Posted: Fri Jan 26, 2007 2:56 pm
by Ollie Saunders
The PHP Developer Network - PHP Throw Down team are planning on using XSLT pretty extensively. We are also using ZF too so there'll be code like this:

Code: Select all

class SomeController extends Zend_Controller_Action
{
    public function indexAction()
    {
        $xml = /* generate bunch of xml dependent on business logic*/;
        echo xsltTransform($xml, 'xsltfilename');
    }
}
My question is exactly how am I going to test the business logic here?
We seriously won't need to test the XSLT but everything up until that function call (xsltTransform()) will need to be tested. But how?

Posted: Sat Jan 27, 2007 12:27 pm
by Ambush Commander
Mock XSLT transform and use XPath to ensure that the DOM has the main features.