zoe             Sun Jun 28 09:46:49 2009 UTC

  Added files:                 
    /phpruntests/src/testcase/output    rtTestOutputWriterCSV.php 
  Log:
  csv writer for output checking
  

http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/output/rtTestOutputWriterCSV.php?view=markup&rev=1.1
Index: phpruntests/src/testcase/output/rtTestOutputWriterCSV.php
+++ phpruntests/src/testcase/output/rtTestOutputWriterCSV.php
<?php
/**
 * rtTestOutputWriterCSV
 *
 * Write minimal testoutput and status a CSV
 * 
 * @category   Testing
 * @package    RUNTESTS
 * @author     Zoe Slattery <z...@php.net>
 * @author     Stefan Priebsch <sprieb...@php.net>
 * @copyright  2009 The PHP Group
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
 * @link       http://qa.php.net/
 * 
 */
class rtTestOutputWriterCSV extends rtTestOutputWriter
{
    protected $testOutput = array();

    public function __construct(array $testResults)
    {
        $this->init($testResults);
    }

    /**
     *
     *
     * @param array of rtTestResults
     *
     */
    public function init (array $testResults)
    {
        foreach ($testResults as $testResult) {
            $outputString = $testResult->getName();
            $testStatus = $testResult->getStatus();
            foreach($testStatus->getTestStateNames() as $name) {
                if($testStatus->getValue($name)) {
                    $outputString .= " , ". strtoupper($name);
                    
                }
            }
            $this->testOutput[] = $outputString;
        }
    }


    public function write($testDirectory = null)
    {
        sort($this->testOutput);
        foreach ($this->testOutput as $line) {
            echo $line ."\n";
        }
    }
}
?>


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to