Development

Changeset 20485

You must first sign up to be able to contribute.

Changeset 20485

Show
Ignore:
Timestamp:
07/25/09 10:36:55 (5 years ago)
Author:
bschussek
Message:

Removed redundant method LimeTest::toXml()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/lime/branches/2.0-experimental/lib/LimeTest.php

    r20392 r20485  
    9393  } 
    9494 
    95   static public function toXml($results = null) 
    96   { 
    97     if (is_null($results)) 
    98     { 
    99       $results = self::$allResults; 
    100     } 
    101  
    102     $dom = new DOMDocument('1.0', 'UTF-8'); 
    103     $dom->formatOutput = true; 
    104     $dom->appendChild($testsuites = $dom->createElement('testsuites')); 
    105  
    106     $errors = 0; 
    107     $failures = 0; 
    108     $errors = 0; 
    109     $skipped = 0; 
    110     $assertions = 0; 
    111  
    112     foreach ($results as $result) 
    113     { 
    114       $testsuites->appendChild($testSuite = $dom->createElement('testsuite')); 
    115       $testSuite->setAttribute('name', basename($result['file'], '.php')); 
    116       $testSuite->setAttribute('file', $result['file']); 
    117       $testSuite->setAttribute('failures', count($result['stats']['failed'])); 
    118       $testSuite->setAttribute('errors', 0); 
    119       $testSuite->setAttribute('skipped', count($result['stats']['skipped'])); 
    120       $testSuite->setAttribute('tests', $result['stats']['plan']); 
    121       $testSuite->setAttribute('assertions', $result['stats']['plan']); 
    122  
    123       $failures += count($result['stats']['failed']); 
    124       $skipped += count($result['stats']['skipped']); 
    125       $assertions += $result['stats']['plan']; 
    126  
    127       foreach ($result['tests'] as $test) 
    128       { 
    129         $testSuite->appendChild($testCase = $dom->createElement('testcase')); 
    130         $testCase->setAttribute('name', $test['message']); 
    131         $testCase->setAttribute('file', $test['file']); 
    132         $testCase->setAttribute('line', $test['line']); 
    133         $testCase->setAttribute('assertions', 1); 
    134         if (!$test['status']) 
    135         { 
    136           $testCase->appendChild($failure = $dom->createElement('failure')); 
    137           $failure->setAttribute('type', 'lime'); 
    138           if ($test['error']) 
    139           { 
    140             $failure->appendChild($dom->createTextNode($test['error'])); 
    141           } 
    142         } 
    143       } 
    144     } 
    145  
    146     $testsuites->setAttribute('failures', $failures); 
    147     $testsuites->setAttribute('errors', $errors); 
    148     $testsuites->setAttribute('tests', $assertions); 
    149     $testsuites->setAttribute('assertions', $assertions); 
    150     $testsuites->setAttribute('skipped', $skipped); 
    151  
    152     return $dom->saveXml(); 
    153   } 
    154  
    15595  static protected function findCaller() 
    15696  {