PHP Unit Testing Framework 1
A Unit testing framework for PHP.

xml_test_runner_with_style_sheet.php

Go to the documentation of this file.
00001 <?php
00041 
00042 require_once 'xml_test_runner.php';
00043 
00051 abstract class XMLTestRunnerWithStyleSheet extends XMLTestRunner
00052 {
00053   protected $styleSheet; 
00054   
00067   public function __construct()
00068   {
00069     $this->styleSheet = '<?xml version="1.0" encoding="US-ASCII"?' .
00070                          ">\n<xsl:stylesheet version=\"1.0\"\n" .
00071                          "                xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n";
00072   }
00073   
00079   public function Report()
00080   {
00081     $xsl = new DOMDocument;
00082     if (!$xsl->loadXML($this->styleSheet))
00083     {
00084       throw new Exception("Unable to parse sylesheet:\n" . $this->styleSheet);
00085     }
00086     $xml = new DOMDocument;
00087     $report = parent::Report();
00088 
00089     //$xml->preserveWhiteSpace = false;
00090     if (!$xml->loadXML($report))
00091     {
00092       throw new Exception("Unable to parse XML:\n" . $report);
00093     }
00094 
00095     $proc = new XSLTProcessor;
00096     $proc->importStyleSheet($xsl);
00097 
00098     return $proc->transformToXML($xml);
00099   }
00100 }
00101 ?>
 All Data Structures Files Functions Variables

© 2011, Ed Heal