[PHP-CVS] cvs: phpruntests /src/configuration rtCommandLineOptions.php /src/testcase rtTestOutputWriter.php /src/testrun rtPhpTestRun.php
g2 Mon Jul 6 20:35:54 2009 UTC Modified files: /phpruntests/src/configuration rtCommandLineOptions.php /phpruntests/src/testrunrtPhpTestRun.php /phpruntests/src/testcase rtTestOutputWriter.php Log: phpruntests - update outputWriter, adjusted command-line-arguments http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/rtCommandLineOptions.php?r1=1.8&r2=1.9&diff_format=u Index: phpruntests/src/configuration/rtCommandLineOptions.php diff -u phpruntests/src/configuration/rtCommandLineOptions.php:1.8 phpruntests/src/configuration/rtCommandLineOptions.php:1.9 --- phpruntests/src/configuration/rtCommandLineOptions.php:1.8 Sun Jul 5 20:51:16 2009 +++ phpruntests/src/configuration/rtCommandLineOptions.php Mon Jul 6 20:35:53 2009 @@ -23,7 +23,7 @@ 'm', 'q', 'x', -'v', +'v', // verbose-mode level 1 'h', ); @@ -38,17 +38,17 @@ 'c', 'd', 'p', -'s', -'o', //new for output type (list, xml, csv...) - 'z', //parallel - run out of obvious letters - 'g', // flushing report durring test-execution +'s', // save - defines the filename to store the results +'o', // output type (list, xml, csv...) + 'z', // parallel - run out of obvious letters ); /** * @var array */ protected $longOptions = array( -'verbose', +'vv', // verbose-mode level 2 + 'vvv', // verbose-mode level 3 'help', 'keep-all', 'keep-php', http://cvs.php.net/viewvc.cgi/phpruntests/src/testrun/rtPhpTestRun.php?r1=1.20&r2=1.21&diff_format=u Index: phpruntests/src/testrun/rtPhpTestRun.php diff -u phpruntests/src/testrun/rtPhpTestRun.php:1.20 phpruntests/src/testrun/rtPhpTestRun.php:1.21 --- phpruntests/src/testrun/rtPhpTestRun.php:1.20 Sun Jul 5 20:51:16 2009 +++ phpruntests/src/testrun/rtPhpTestRun.phpMon Jul 6 20:35:54 2009 @@ -63,15 +63,14 @@ } } -// check for the cmd-line-option 'g' which defines the report-status +// check for the cmd-line-option 'v' which defines the report-status $reportStatus = 0; -if ($runConfiguration->hasCommandLineOption('g')) { - - $reportStatus = $runConfiguration->getCommandLineOption('g'); - - if (!is_numeric($reportStatus) || $processCount < 0) { - $reportStatus = 1; - } +if ($runConfiguration->hasCommandLineOption('v')) { + $reportStatus = 1; +} else if ($runConfiguration->hasCommandLineOption('vv')) { + $reportStatus = 2; +} else if ($runConfiguration->hasCommandLineOption('vvv')) { + $reportStatus = 3; } // create the task-list @@ -98,9 +97,14 @@ $outputWriter = rtTestOutputWriter::getInstance($type); $outputWriter->setResultList($resultList); $outputWriter->printOverview(sizeof($taskList), $scheduler->getProcessCount()); + + $filename = null; + if ($runConfiguration->hasCommandLineOption('s')) { + $filename = $runConfiguration->getCommandLineOption('s'); + } - if ($runConfiguration->hasCommandLineOption('o')) { - $outputWriter->write(); + if ($type || $filename) { + $outputWriter->write($filename); } } else { http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtTestOutputWriter.php?r1=1.7&r2=1.8&diff_format=u Index: phpruntests/src/testcase/rtTestOutputWriter.php diff -u phpruntests/src/testcase/rtTestOutputWriter.php:1.7 phpruntests/src/testcase/rtTestOutputWriter.php:1.8 --- phpruntests/src/testcase/rtTestOutputWriter.php:1.7 Sun Jul 5 20:51:16 2009 +++ phpruntests/src/testcase/rtTestOutputWriter.php Mon Jul 6 20:35:54 2009 @@ -70,7 +70,7 @@ -public function write() +public function write($filename=null) { $this->createOutput(); @@ -80,10 +80,12 @@ mkdir(self::OUTPUT_DIR); } - $file = self::OUTPUT_DIR.'/results_'.microtime(true).'.'.$this->type; + if (is_null($filename)) { + $filename = self::OUTPUT_DIR.'/results_'.round(microtime(true)).'.'.$this->type; + } - if (file_put_contents($file, $this->output)) { - print "\nThe Test-Results were saved in <$file>\n"; + if (file_put_contents($filename, $this->output)) { + print "\nThe Test-Results were
[PHP-CVS] cvs: phpruntests /src/configuration rtCommandLineOptions.php /src/taskScheduler rtTaskTestGroup.php /src/testgroup rtPhpTestGroup.php /src/testrun rtPhpTestRun.php
zoe Sun Jun 28 12:25:00 2009 UTC Modified files: /phpruntests/src/taskScheduler rtTaskTestGroup.php /phpruntests/src/testrunrtPhpTestRun.php /phpruntests/src/testgroup rtPhpTestGroup.php /phpruntests/src/configuration rtCommandLineOptions.php Log: add option for different types of output http://cvs.php.net/viewvc.cgi/phpruntests/src/taskScheduler/rtTaskTestGroup.php?r1=1.2&r2=1.3&diff_format=u Index: phpruntests/src/taskScheduler/rtTaskTestGroup.php diff -u phpruntests/src/taskScheduler/rtTaskTestGroup.php:1.2 phpruntests/src/taskScheduler/rtTaskTestGroup.php:1.3 --- phpruntests/src/taskScheduler/rtTaskTestGroup.php:1.2 Sat Jun 27 17:47:54 2009 +++ phpruntests/src/taskScheduler/rtTaskTestGroup.php Sun Jun 28 12:25:00 2009 @@ -27,7 +27,12 @@ { $testGroup = new rtPhpTestGroup($this->runConfiguration, $this->subDirectory); $testGroup->runGroup($this->runConfiguration); - $testGroup->writeGroup(); + + $outType = 'list'; +if ($this->runConfiguration->hasCommandLineOption('o')) { + $outType = $this->runConfiguration->getCommandLineOption('o'); +} + $testGroup->writeGroup($outType); return true; } http://cvs.php.net/viewvc.cgi/phpruntests/src/testrun/rtPhpTestRun.php?r1=1.13&r2=1.14&diff_format=u Index: phpruntests/src/testrun/rtPhpTestRun.php diff -u phpruntests/src/testrun/rtPhpTestRun.php:1.13 phpruntests/src/testrun/rtPhpTestRun.php:1.14 --- phpruntests/src/testrun/rtPhpTestRun.php:1.13 Sat Jun 27 13:53:54 2009 +++ phpruntests/src/testrun/rtPhpTestRun.phpSun Jun 28 12:25:00 2009 @@ -36,6 +36,12 @@ // $preConditionList->check($this->commandLine, $this->environmentVariables); $preConditionList->check($runConfiguration); + +//Set the type of output. Defaults to 'list' - comatible with old version +$this->outType = 'list'; +if ($runConfiguration->hasCommandLineOption('o')) { + $this->outType = $runConfiguration->getCommandLineOption('o'); +} if ($runConfiguration->getSetting('TestDirectories') != null) { @@ -73,7 +79,7 @@ foreach ($subDirectories as $subDirectory) { $testGroup = new rtPhpTestGroup($runConfiguration, $subDirectory); $testGroup->runGroup($runConfiguration); - $testGroup->writeGroup(); + $testGroup->writeGroup($this->outType); } } http://cvs.php.net/viewvc.cgi/phpruntests/src/testgroup/rtPhpTestGroup.php?r1=1.9&r2=1.10&diff_format=u Index: phpruntests/src/testgroup/rtPhpTestGroup.php diff -u phpruntests/src/testgroup/rtPhpTestGroup.php:1.9 phpruntests/src/testgroup/rtPhpTestGroup.php:1.10 --- phpruntests/src/testgroup/rtPhpTestGroup.php:1.9Sun Jun 14 13:52:21 2009 +++ phpruntests/src/testgroup/rtPhpTestGroup.phpSun Jun 28 12:25:00 2009 @@ -70,9 +70,9 @@ } } -public function writeGroup() +public function writeGroup($outType) { -$testOutputWriter = rtTestOutputWriter::getInstance($this->results, 'list'); +$testOutputWriter = rtTestOutputWriter::getInstance($this->results, $outType); $testOutputWriter->write($this->testDirectory); } } http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/rtCommandLineOptions.php?r1=1.6&r2=1.7&diff_format=u Index: phpruntests/src/configuration/rtCommandLineOptions.php diff -u phpruntests/src/configuration/rtCommandLineOptions.php:1.6 phpruntests/src/configuration/rtCommandLineOptions.php:1.7 --- phpruntests/src/configuration/rtCommandLineOptions.php:1.6 Fri Jun 26 00:07:24 2009 +++ phpruntests/src/configuration/rtCommandLineOptions.php Sun Jun 28 12:25:00 2009 @@ -39,6 +39,7 @@ 'd', 'p', 's', +'o', //new for output type (list, xml, csv...) 'z', //parallel - run out of obvious letters ); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: phpruntests /src/configuration rtCommandLineOptions.php
spriebsch Mon May 11 21:28:16 2009 UTC Modified files: /phpruntests/src/configuration rtCommandLineOptions.php Log: Added comments. http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/rtCommandLineOptions.php?r1=1.3&r2=1.4&diff_format=u Index: phpruntests/src/configuration/rtCommandLineOptions.php diff -u phpruntests/src/configuration/rtCommandLineOptions.php:1.3 phpruntests/src/configuration/rtCommandLineOptions.php:1.4 --- phpruntests/src/configuration/rtCommandLineOptions.php:1.3 Fri Apr 24 08:41:25 2009 +++ phpruntests/src/configuration/rtCommandLineOptions.php Mon May 11 21:28:16 2009 @@ -10,7 +10,7 @@ class rtCommandLineOptions { /** - * + * @var array */ protected $shortOptions = array( 'n', @@ -22,6 +22,9 @@ 'z', //parallel - run out of obvious letters ); +/** + * @var array + */ protected $shortOptionsWithArgs = array( 'l', 'r', @@ -33,6 +36,9 @@ 's', ); +/** + * @var array + */ protected $longOptions = array( 'verbose', 'help', @@ -52,6 +58,9 @@ 'no-clean', ); +/** + * @var array + */ protected $longOptionsWithArgs = array( 'html', 'temp-source', @@ -59,24 +68,54 @@ 'set-timeout', ); +/** + * @var array + */ protected $options = array(); +/** + * @var array + */ protected $testFilename = array(); +/** + * Constructs the object + */ public function __construct() { } +/** + * Parse the command line options + * + * @param array $argv Command line arguments + * @return void + */ public function parse($argv) { $this->parseCommandLineOptions($this->stripSpaces($argv)); } +/** + * Returns true when argument is a short option, + * i.e. begins with -. To differentiate from long option (--) + * we also look at the second character, which may not be a - character. + * + * @param string $arg Single command line argument + * @return bool + */ protected function isShortOption($arg) { return (substr($arg, 0, 1) == '-') && (substr($arg, 1, 1) != '-'); } +/** + * Returns true when argument is a long option, + * i.e. begins with -- + * + * @param string $arg Single command line argument + * @return bool + */ protected function isLongOption($arg) { return substr($arg, 0, 2) == '--'; @@ -89,6 +128,9 @@ * --{longOption} * --{longOptionWithArg} {arg} * file name|directory name + * + * @param array $argv Command line arguments + * @return void */ public function parseCommandLineOptions($argv) { @@ -123,10 +165,11 @@ } } - /** * Checks to make sure that the arument following does not begin with "-" - * @param string - argument + * + * @param array $array arguments + * @param string $index array index * @return bool */ public function isValidOptionArg($array, $index) @@ -159,7 +202,9 @@ /** + * Returns the value of given option. * + * @param string $option option name */ public function getOption($option) { @@ -172,7 +217,10 @@ /** - * Check whether an option exists + * Check whether an option exists. + * + * @param string $option option name + * @return bool */ public function hasOption($option) { @@ -181,7 +229,9 @@ /** - * Return the array containing file names or directory names to be tested + * Return the array containing file names or directory names to be tested. + * + * @return string */ public function getTestFilename() { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php