Changeset 208

Show
Ignore:
Timestamp:
07/30/07 19:43:37 (1 year ago)
Author:
mrook
Message:

Improve PHPUnit 3 detection code (patch by Doug Warner, closes issue #91)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/phing/tasks/ext/phpunit/PHPUnitTask.php

    r178 r208  
    5959                 
    6060                /** 
    61                  * Ugly hack to get PHPUnit version number 
     61                 * Ugly hack to get PHPUnit version number from PEAR 
    6262                 */ 
    6363                $config = new PEAR_Config(); 
     
    7979                { 
    8080                        /** 
    81                          * Try to find PHPUnit2 
     81                         * Try to find PHPUnit3 
    8282                         */ 
    83                         require_once 'PHPUnit2/Util/Filter.php'; 
    84                          
    85                         if (!class_exists('PHPUnit2_Util_Filter')) { 
    86                                 throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation()); 
    87                         } 
    88                          
    89                         PHPUnitUtil::$installedVersion = 2; 
     83                        @include_once 'PHPUnit/Util/Filter.php'; 
     84                         
     85                        if (class_exists('PHPUnit_Util_Filter')) 
     86                        { 
     87                                PHPUnitUtil::$installedVersion = 3; 
     88                        } 
     89                        else 
     90                        {                        
     91                                /** 
     92                                 * Try to find PHPUnit2 
     93                                 */ 
     94                                @include_once 'PHPUnit2/Util/Filter.php'; 
     95                         
     96                                if (!class_exists('PHPUnit2_Util_Filter')) { 
     97                                        throw new BuildException("PHPUnit task depends on PEAR PHPUnit 2 or 3 package being installed.", $this->getLocation()); 
     98                                } 
     99 
     100                                PHPUnitUtil::$installedVersion = 2; 
     101                        } 
    90102                } 
    91103