Login   Register  
PHP Classes
elePHPant
Icontem

File: test-xmlthing.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2008-04-13 08:33
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($data1).'</pre>';

        echo 
'<table><tr valign="top">';
        echo 
'<td>KEY ARRAY:<pre>'.print_r($xml->keyArray1).'</pre></td>';
        echo 
'<td>VALUE ARRAY:<pre>'.print_r($xml->valueArray1).'</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__);
}
?>