Ticket #91: PHPUnitTask-PHPUnit3check.diff

File PHPUnitTask-PHPUnit3check.diff, 1.1 KB (added by DougWarner <silfreed-phing@…>, 5 years ago)

Improved detection of PHPUnit3

  • .php

    old new  
    7878                else 
    7979                { 
    8080                        /** 
     81                         * Try to find PHPUnit3 
     82                         */ 
     83                        @include_once 'PHPUnit/Util/Filter.php'; 
     84                        if (class_exists('PHPUnit_Util_Filter')) 
     85                        { 
     86                                PHPUnitUtil::$installedVersion = 3; 
     87                        } 
     88                         
     89                        /** 
    8190                         * Try to find PHPUnit2 
    8291                         */ 
    83                         require_once 'PHPUnit2/Util/Filter.php'; 
     92                        else 
     93                        { 
     94                                @include_once 'PHPUnit2/Util/Filter.php'; 
    8495                         
    8596                        if (!class_exists('PHPUnit2_Util_Filter')) { 
    8697                                throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation()); 
     
    8899                         
    89100                        PHPUnitUtil::$installedVersion = 2; 
    90101                } 
     102                        if (!class_exists('PHPUnit_Util_Filter') 
     103                                && !class_exists('PHPUnit2_Util_Filter')) 
     104                        { 
     105                                throw new BuildException("PHPUnit Task depends on PHPUnit2 or PHPUnit3 being installed", $this->getLocation()); 
     106                        } 
     107                } 
    91108                 
    92109                // other dependencies that should only be loaded when class is actually used. 
    93110                require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';