Changeset 119

Show
Ignore:
Timestamp:
02/29/08 22:47:35 (11 months ago)
Author:
iteman
Message:

- Refactored.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/Stagehand/TestRunner/Common.php

    r118 r119  
    7676     */ 
    7777 
    78     private $_targetPath; 
    79     private $_isRecursive; 
     78    private $_suite; 
    8079 
    8180    /**#@-*/ 
     
    113112        } 
    114113 
    115         $this->_targetPath = $absoluteTargetPath; 
    116         $this->_color = $color; 
    117         $this->_isRecursive = is_dir($absoluteTargetPath) && $isRecursive; 
    118     } 
    119  
    120     // }}} 
    121     // {{{ run() 
    122  
    123     /** 
    124      * Runs tests in the directory. 
    125      * 
    126      * @return stdClass 
    127      */ 
    128     public function run() 
    129     { 
    130         if ($this->_isRecursive) { 
     114        if (is_dir($absoluteTargetPath) && $isRecursive) { 
    131115            $suite = $this->_createTestSuite(); 
    132             $directories = $this->_getDirectories($this->_targetPath); 
     116            $directories = $this->_getDirectories($absoluteTargetPath); 
    133117            for ($i = 0, $count = count($directories); $i < $count; ++$i) { 
    134118                $this->_buildTestSuite($suite, $directories[$i]); 
    135119            } 
    136120        } else { 
    137             $suite = $this->_buildTestSuite($this->_createTestSuite(), $this->_targetPath); 
    138         } 
    139  
    140         return $this->_doRun($suite); 
     121            $suite = $this->_buildTestSuite($this->_createTestSuite(), $absoluteTargetPath); 
     122        } 
     123 
     124        $this->_suite = $suite; 
     125        $this->_color = $color; 
     126    } 
     127 
     128    // }}} 
     129    // {{{ run() 
     130 
     131    /** 
     132     * Runs tests in the directory. 
     133     * 
     134     * @return stdClass 
     135     */ 
     136    public function run() 
     137    { 
     138        return $this->_doRun($this->_suite); 
    141139    } 
    142140