com phpruntests: phpruntests - update outputWriter, adjusted command-line-arguments: src/configuration/rtCommandLineOptions.php
src/testcase/rtTestOutputWriter.php src/testrun/rtPhpTestRun.php
| From: | David Soria Parra | Date: | Mon, 06 Jul 2009 20:35:54 +0000 |
| Subject: | com phpruntests: phpruntests - update outputWriter, adjusted command-line-arguments: src/configuration/rtCommandLineOptions.php src/testcase/rtTestOutputWriter.php src/testrun/rtPhpTestRun.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66364@lists.php.net to get a copy of this message | ||
Commit: 851a2b803d3dc8306e6a8d4b2a477a71daf45fb9
Author: Georg Gradwohl <g2@php.net> Mon, 6 Jul 2009 20:35:54 +0000
Parents: 159782c0e0a614ce1d5b0080c9ab8958797f2f2a
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=851a2b803d3dc8306e6a8d4b2a477a71daf45fb9
Log:
phpruntests - update outputWriter, adjusted command-line-arguments
Changed paths:
M src/configuration/rtCommandLineOptions.php
M src/testcase/rtTestOutputWriter.php
M src/testrun/rtPhpTestRun.php
Diff:
diff --git a/src/configuration/rtCommandLineOptions.php b/src/configuration/rtCommandLineOptions.php
index e9cdae1..26d0bb1 100644
--- a/src/configuration/rtCommandLineOptions.php
+++ b/src/configuration/rtCommandLineOptions.php
@@ -23,7 +23,7 @@ class rtCommandLineOptions
'm',
'q',
'x',
- 'v',
+ 'v', // verbose-mode level 1
'h',
);
@@ -38,17 +38,17 @@ class rtCommandLineOptions
'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',
diff --git a/src/testcase/rtTestOutputWriter.php b/src/testcase/rtTestOutputWriter.php
index 68ec987..e9173a8 100644
--- a/src/testcase/rtTestOutputWriter.php
+++ b/src/testcase/rtTestOutputWriter.php
@@ -70,7 +70,7 @@ abstract class rtTestOutputWriter
- public function write()
+ public function write($filename=null)
{
$this->createOutput();
@@ -80,10 +80,12 @@ abstract class rtTestOutputWriter
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 saved in <$filename>\n";
} else {
print "\nError while saving results.\n";
}
diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php
index 80a0374..f2e37e6 100644
--- a/src/testrun/rtPhpTestRun.php
+++ b/src/testrun/rtPhpTestRun.php
@@ -63,15 +63,14 @@ class rtPhpTestRun
}
}
- // 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 @@ class rtPhpTestRun
$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 {