PHPTD - Testing XML

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

PHPTD - Testing XML

Post 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?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Mock XSLT transform and use XPath to ensure that the DOM has the main features.
Post Reply