Exemplo n.º 1
0
 /**
  * Signals/Paints the end of a TestSuite. All test cases have run
  * and timers are stopped.
  *
  * @return void
  */
 function paintGroupEnd($test_name)
 {
     $this->_timeEnd = $this->_getTime();
     $this->_timeDuration = $this->_timeEnd - $this->_timeStart;
     parent::paintGroupEnd($test_name);
 }
Exemplo n.º 2
0
 function paintGroupEnd($test_name)
 {
     parent::paintGroupEnd($test_name);
 }
Exemplo n.º 3
0
    /**
     *    Paints the end of a group test. Will paint the page
     *    footer if the stack of tests has unwound.
     *    @param string $test_name   Name of test that is ending.
     *    @param integer $progress   Number of test cases ending.
     *    @access public
     */
    function paintGroupEnd($test_name) {
        parent::paintGroupEnd($test_name);
        $this->group_depth--;
        if ($this->group_depth==0) {
            //$contents = ob_get_contents();
            //ob_end_clean();
            $phpversion='php5';
            $backend="mysql";
            $this->_outstring='<?xml version="1.0" encoding="'.$this->_character_set.'"?>
<testsuites php-version="'.$this->phpversion.'" backend="'.$this->backend.'">';
            //foreach ($this->output as $level=>$out) {
            $this->_outstring.=implode("\n",$this->output);
            //}
            $this->_outstring.='</testsuites>';
            unset($this->output);
            $this->output=array();
            unset($this->_out);
            $this->_out=array();
        } else if ($this->group_depth==1) {
            $time = time()+microtime(true) - $this->_starttime;
            //$contents = ob_get_contents();
            //ob_end_clean();
            $out="";
            //package="'.$this->suiteName.'"
            $out.='<testsuite name="'.$this->suiteName.'" package="'.$this->suiteName.'" file="'.$this->fileName.'"  tests="'.$this->_sizes[$this->suiteName].'" failures="'.(isset($this->_failCounts[$this->suiteName])?$this->_failCounts[$this->suiteName]:0).'" errors="'.(isset($this->_exceptionCounts[$this->suiteName])?$this->_exceptionCounts[$this->suiteName]:0).'" time="'.$time.'">';
            if (isset($this->_out[$this->group_depth]) && is_array($this->_out[$this->group_depth])) {
                foreach ($this->_out[$this->group_depth] as $level=>$string) {
                    $out.=$string;
                }
            }
            $out.="</testsuite>";
            $this->_out[$this->group_depth] = array();
            $this->output[]=$out;
        } else if($this->group_depth==3) {
            //$contents = ob_get_contents();
            //ob_end_clean();
            $time = time()+microtime(true) - $this->_startsubtime;
            $out = "";
            $out.='<testsuite name="'.$this->suiteName.'::'.basename($this->testFileName).'" file="'.$this->testFileName.'" package="'.$this->suiteName.'" tests="'.(isset($this->_sizes[$this->testFileName])?$this->_sizes[$this->testFileName]:0).'" failures="'.(isset($this->_failCounts[$this->testFileName])?$this->_failCounts[$this->testFileName]:0).'" errors="'.(isset($this->_exceptionCounts[$this->testFileName])?$this->_exceptionCounts[$this->testFileName]:0).'" time="'.$time.'">';
            if (isset($this->_out[$this->group_depth+1]) && is_array($this->_out[$this->group_depth+1]) && count($this->_out[$this->group_depth+1])>0) {
                foreach ($this->_out[$this->group_depth+1] as $level=>$string) {
                    $out.=$string;
                }
            } else {
                if (@$this->_failCounts[$this->suiteName]+@$this->_exceptionCounts[$this->suiteName]>0) {
                    for($i=0;$i<@$this->_failCounts[$this->suiteName]+@$this->_exceptionCounts[$this->suiteName];$i++) {
                        $message = @array_shift($this->fail_messages);
                        if($message!=null) {
                            $out.='<error>';
                            $out.="<![CDATA[";
                            $out.=$message;
                            $out.="]]>";
                            $out.='</error>';
                        }
                    }
                }
            }
            $out.="</testsuite>";
            if (!isset($this->_out[1])) {
                $this->_out[1] = array();
            }
            $this->_out[1][]=$out;
            $this->_out[$this->group_depth+1] = array();
        }

        //$this->_fails = 0;
        //$this->_passes = 0;
    }