Ticket #420: PHPUnitTask.php.2.patch

File PHPUnitTask.php.2.patch, 5.4 KB (added by bschultz@…, 2 years ago)
  • classes/phing/tasks/ext/phpunit/PHPUnitTask.php

     
    6565        { 
    6666            throw new BuildException("PHPUnitTask requires PHP version >= 5.0.3", $this->getLocation()); 
    6767        } 
    68          
     68 
    6969        /** 
    7070         * Determine PHPUnit version number 
    7171         */ 
     
    7777        { 
    7878            throw new BuildException("PHPUnitTask requires PHPUnit version >= 3.2.0", $this->getLocation()); 
    7979        } 
    80              
     80 
    8181        /** 
    8282         * Other dependencies that should only be loaded when class is actually used. 
    8383         */ 
     
    9292 
    9393        require_once 'PHPUnit/Framework.php'; 
    9494        require_once 'PHPUnit/Util/Filter.php'; 
    95              
     95 
    9696        // point PHPUnit_MAIN_METHOD define to non-existing method 
    9797        if (!defined('PHPUnit_MAIN_METHOD')) 
    9898        { 
    9999            define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined'); 
    100100        } 
    101          
     101 
    102102        $path = realpath($pwd . '/../../../'); 
    103103        PHPUnit_Util_Filter::addDirectoryToFilter($path); 
    104104    } 
    105      
     105 
    106106    /** 
    107107     * Sets the name of a bootstrap file that is run before 
    108108     * executing the tests 
     
    113113    { 
    114114        $this->bootstrap = $bootstrap; 
    115115    } 
    116      
     116 
    117117    function setErrorproperty($value) 
    118118    { 
    119119        $this->errorproperty = $value; 
    120120    } 
    121      
     121 
    122122    function setFailureproperty($value) 
    123123    { 
    124124        $this->failureproperty = $value; 
    125125    } 
    126      
     126 
    127127    function setIncompleteproperty($value) 
    128128    { 
    129129        $this->incompleteproperty = $value; 
    130130    } 
    131      
     131 
    132132    function setSkippedproperty($value) 
    133133    { 
    134134        $this->skippedproperty = $value; 
    135135    } 
    136      
     136 
    137137    function setHaltonerror($value) 
    138138    { 
    139139        $this->haltonerror = $value; 
     
    158158    { 
    159159        $this->printsummary = $printsummary; 
    160160    } 
    161      
     161 
    162162    function setCodecoverage($codecoverage) 
    163163    { 
    164164        $this->codecoverage = $codecoverage; 
     
    184184    { 
    185185        $token = ' ,;'; 
    186186        $this->excludeGroups = array(); 
    187         $tok = strtok($groups, $token); 
     187        $tok = strtok($excludeGroups, $token); 
    188188        while ($tok !== false) { 
    189189            $this->excludeGroups[] = $tok; 
    190190            $tok = strtok($token); 
     
    214214        } 
    215215 
    216216        $tests = array(); 
    217          
     217 
    218218        if ($this->printsummary) 
    219219        { 
    220220            $fe = new FormatterElement(); 
     
    222222            $fe->setUseFile(false); 
    223223            $this->formatters[] = $fe; 
    224224        } 
    225          
     225 
    226226        if ($this->bootstrap) 
    227227        { 
    228228            require_once $this->bootstrap; 
    229229        } 
    230          
     230 
    231231        foreach ($this->formatters as $fe) 
    232232        { 
    233233            $formatter = $fe->getFormatter(); 
     
    236236            if ($fe->getUseFile()) 
    237237            { 
    238238                $destFile = new PhingFile($fe->getToDir(), $fe->getOutfile()); 
    239                  
     239 
    240240                $writer = new FileWriter($destFile->getAbsolutePath()); 
    241241 
    242242                $formatter->setOutput($writer); 
     
    248248 
    249249            $formatter->startTestRun(); 
    250250        } 
    251          
     251 
    252252        foreach ($this->batchtests as $batchtest) 
    253253        { 
    254254            $this->execute($batchtest->getTestSuite()); 
    255         }            
    256          
     255        } 
     256 
    257257        foreach ($this->formatters as $fe) 
    258258        { 
    259259            $formatter = $fe->getFormatter(); 
    260260            $formatter->endTestRun(); 
    261261        } 
    262          
     262 
    263263        if ($this->testfailed) 
    264264        { 
    265265            throw new BuildException($this->testfailuremessage); 
     
    272272    private function execute($suite) 
    273273    { 
    274274        $runner = new PHPUnitTestRunner($this->project, $this->groups, $this->excludeGroups); 
    275          
     275 
    276276        $runner->setCodecoverage($this->codecoverage); 
    277277        $runner->setUseCustomErrorHandler($this->usecustomerrorhandler); 
    278278 
     
    280280        { 
    281281            $formatter = $fe->getFormatter(); 
    282282 
    283             $runner->addFormatter($formatter);       
     283            $runner->addFormatter($formatter); 
    284284        } 
    285          
     285 
    286286        $runner->run($suite); 
    287287 
    288288        $retcode = $runner->getRetCode(); 
    289          
     289 
    290290        if ($retcode == PHPUnitTestRunner::ERRORS) { 
    291291            if ($this->errorproperty) { 
    292292                $this->project->setNewProperty($this->errorproperty, true); 
     
    299299            if ($this->failureproperty) { 
    300300                $this->project->setNewProperty($this->failureproperty, true); 
    301301            } 
    302              
     302 
    303303            if ($this->haltonfailure) { 
    304304                $this->testfailed = true; 
    305305                $this->testfailuremessage = $runner->getLastFailureMessage(); 
     
    308308            if ($this->incompleteproperty) { 
    309309                $this->project->setNewProperty($this->incompleteproperty, true); 
    310310            } 
    311              
     311 
    312312            if ($this->haltonincomplete) { 
    313313                $this->testfailed = true; 
    314314                $this->testfailuremessage = $runner->getLastFailureMessage(); 
     
    317317            if ($this->skippedproperty) { 
    318318                $this->project->setNewProperty($this->skippedproperty, true); 
    319319            } 
    320              
     320 
    321321            if ($this->haltonskipped) { 
    322322                $this->testfailed = true; 
    323323                $this->testfailuremessage = $runner->getLastFailureMessage();