PHP Classes

File: test-xmlthing.php

Recommend this page to a friend!
  Classes of D Moore   XML to Sensible Array   test-xmlthing.php   Download  
File: test-xmlthing.php
Role: Unit test script
Content type: text/plain
Description: Simpletest script and translated output
Class: XML to Sensible Array
Parse XML documents into associative arrays
Author: By
Last change:
Date: 16 years ago
Size: 953 bytes
 

Contents

Class file image Download
<?php
/**
* Testing rig for XMLThing
*
*/

require_once('simpletest/unit_tester.php');
require_once(
'simpletest/reporter.php');

require_once(
'xml-test-data.php');
require_once(
"xmlthing.class.php");


   
/**
    *
    */

class Test_Case extends UnitTestCase
{
    function
testOne()
    {
        global
$xml1, $xmlbasic, $xmlphoto, $xmltiny;

       
$xml = new XMLThing($xmlphoto);

       
$data = $xml->parse();

       
$this->assertTrue(is_array($data));

        echo
'TRANSLATED<pre>'.print_r($data, 1).'</pre>';

        echo
'<table><tr valign="top">';
        echo
'<td>KEY ARRAY:<pre>'.print_r($xml->keyArray, 1).'</pre></td>';
        echo
'<td>VALUE ARRAY:<pre>'.print_r($xml->valueArray, 1).'</pre></td>';
        echo
'</tr></table>';
    }
}


   
// run only if this file is directly called

if (__FILE__ == realpath($_SERVER['SCRIPT_FILENAME']))
{
   
$test = new Test_Case('Test My XML Stuff');

   
$test->run(new HTMLReporter);

   
highlight_file(__FILE__);
}
?>