Changeset 98

Show
Ignore:
Timestamp:
12/19/07 10:51:32 (13 months ago)
Author:
iteman
Message:

- Added support for include pattern.

Location:
trunk/src/Stagehand/TestRunner
Files:
2 modified

Legend:

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

    r88 r98  
    6666    protected $_suffix = 'TestCase'; 
    6767    protected $_color; 
     68    protected $_includePattern; 
    6869 
    6970    /**#@-*/ 
     
    240241    private function _exclude($class) 
    241242    { 
    242         if (strlen($this->_excludePattern) && preg_match($this->_excludePattern, $class)) { 
     243        if (!is_null($this->_excludePattern) && preg_match($this->_excludePattern, $class)) { 
    243244            return true; 
    244245        } 
     
    297298                } 
    298299 
     300                if (!$this->_include($newClasses[$j])) { 
     301                    continue; 
     302                } 
     303 
    299304                $testCases[] = $newClasses[$j]; 
    300305                print "  => Added [ {$newClasses[$j]} ]\n"; 
     
    339344 
    340345        return $directories; 
     346    } 
     347 
     348    // }}} 
     349    // {{{ _include() 
     350 
     351    /** 
     352     * Returns whether the class should be include or not. 
     353     * 
     354     * @param string $class 
     355     * @return boolean 
     356     */ 
     357    private function _include($class) 
     358    { 
     359        if (!is_null($this->_includePattern) && preg_match($this->_includePattern, $class)) { 
     360            return true; 
     361        } 
     362 
     363        return is_subclass_of($class, $this->_baseClass); 
    341364    } 
    342365 
  • trunk/src/Stagehand/TestRunner/PHPSpec.php

    r93 r98  
    7070     */ 
    7171 
    72     protected $_excludePattern = '!^(PHPSpec_Context|Stagehand_TestRunner_PHPSpec_Context)$!'; 
    7372    protected $_baseClass = 'PHPSpec_Context'; 
    7473    protected $_suffix = 'Spec'; 
     74    protected $_includePattern = '!(^[Dd]escribe|[Ss]pec$)!'; 
    7575 
    7676    /**#@-*/