Changeset 167

Show
Ignore:
Timestamp:
05/25/08 13:41:00 (8 months ago)
Author:
iteman
Message:

- Added a long option "--growl-password=<password>" to specify a password for Growl.

Files:
1 modified

Legend:

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

    r166 r167  
    150150 
    151151Options: 
    152   -h        display this help and exit 
    153   -V        display version information and exit 
    154   -R        run tests recursively 
    155   -c        color the result of a test runner run 
    156   -p <file> preload <file> as a PHP script 
    157   -a        watch for changes in one or more directories and run tests in the test directory recursively when changes are detected (autotest) 
    158   -w <directory1,directory2,...> specify one or more directories to be watched for changes 
    159   -g        notify test results to Growl 
     152  -h                              display this help and exit 
     153  -V                              display version information and exit 
     154  -R                              run tests recursively 
     155  -c                              color the result of a test runner run 
     156  -p <file>                       preload <file> as a PHP script 
     157  -a                              watch for changes in one or more directories 
     158                                  and run tests in the test directory 
     159                                  recursively when changes are detected 
     160                                  (autotest) 
     161  -w <directory1,directory2,...>  specify one or more directories to be watched 
     162                                  for changes 
     163  -g                              notify test results to Growl 
     164      --growl-password=<password> specify <password> for Growl 
    160165 
    161166With no [directory or file], run all tests in the current directory. 
     
    249254        } 
    250255 
     256        if (!is_null($this->_config->growlPassword)) { 
     257            $options[] = "--growl-password={$this->_config->growlPassword}"; 
     258        } 
     259 
    251260        $options[] = $this->_config->directory; 
    252261 
     
    278287        array_shift($argv); 
    279288        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); 
    280         $allOptions = Console_Getopt::getopt2($argv, 'hVRcp:aw:g'); 
     289        $allOptions = Console_Getopt::getopt2($argv, 
     290                                              'hVRcp:aw:g', 
     291                                              array('growl-password=') 
     292                                              ); 
    281293        PEAR::staticPopErrorHandling(); 
    282294        if (PEAR::isError($allOptions)) { 
     
    291303        $targetDirectories = array(); 
    292304        $useGrowl = false; 
     305        $growlPassword = null; 
    293306        foreach ($allOptions as $options) { 
    294307            if (!count($options)) { 
     
    327340                        } 
    328341                        break; 
     342                    case '--growl-password': 
     343                        $growlPassword = $option[1]; 
     344                        break; 
    329345                    } 
    330346                } else { 
     
    340356                             'preloadFile' => $preloadFile, 
    341357                             'targetDirectories' => $targetDirectories, 
    342                              'useGrowl' => $useGrowl 
     358                             'useGrowl' => $useGrowl, 
     359                             'growlPassword' => $growlPassword 
    343360                             ); 
    344361    } 
     
    369386            $notification = $runner->getNotification(); 
    370387            $application = new Net_Growl_Application('Stagehand_TestRunner', 
    371                                                      array('Green', 'Red') 
     388                                                     array('Green', 'Red'), 
     389                                                     $this->_config->growlPassword 
    372390                                                     ); 
    373391            $growl = new Net_Growl($application);