Changeset 1953 for trunk/buildscripts
- Timestamp:
- 05/15/2007 08:54:57 PM (19 months ago)
- Location:
- trunk/buildscripts/phing
- Files:
-
- 2 added
- 5 modified
-
classes/phing/tasks/ext/simpletest/SimpleTestFormatterElement.php (modified) (4 diffs)
-
classes/phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php (modified) (5 diffs)
-
classes/phing/tasks/ext/simpletest/SimpleTestResultFormatter.php (modified) (7 diffs)
-
classes/phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php (modified) (1 diff)
-
classes/phing/tasks/ext/simpletest/SimpleTestTask.php (modified) (12 diffs)
-
classes/phing/tasks/ext/simpletest/SimpleTestXmlResultFormatter.php (added)
-
tasks/PradoSimpleTestTask.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestFormatterElement.php
r1186 r1953 22 22 require_once 'phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php'; 23 23 require_once 'phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php'; 24 require_once 'phing/tasks/ext/ phpunit2/FormatterElement.php';24 require_once 'phing/tasks/ext/simpletest/SimpleTestXmlResultFormatter.php'; 25 25 26 26 /** … … 33 33 * @since 2.2.0 34 34 */ 35 class SimpleTestFormatterElement extends FormatterElement35 class SimpleTestFormatterElement 36 36 { 37 protected $formatter = NULL; 38 39 protected $type = ""; 40 41 protected $useFile = true; 42 43 protected $toDir = "."; 44 45 protected $outfile = ""; 46 37 47 function setType($type) 38 48 { … … 41 51 if ($this->type == "xml") 42 52 { 43 $destFile = new PhingFile($this->toDir, 'testsuites.xml');44 //$this->formatter = new SimpleTestXmlResultFormatter();53 //$destFile = new PhingFile($this->toDir, 'testsuites.xml'); 54 $this->formatter = new SimpleTestXmlResultFormatter(); 45 55 } 46 56 else … … 59 69 } 60 70 } 71 72 function setClassName($className) 73 { 74 $classNameNoDot = Phing::import($className); 75 76 $this->formatter = new $classNameNoDot(); 77 } 78 79 function setUseFile($useFile) 80 { 81 $this->useFile = $useFile; 82 } 83 84 function getUseFile() 85 { 86 return $this->useFile; 87 } 88 89 function setToDir($toDir) 90 { 91 $this->toDir = $toDir; 92 } 93 94 function getToDir() 95 { 96 return $this->toDir; 97 } 98 99 function setOutfile($outfile) 100 { 101 $this->outfile = $outfile; 102 } 103 104 function getOutfile() 105 { 106 if ($this->outfile) 107 { 108 return $this->outfile; 109 } 110 else 111 { 112 return $this->formatter->getPreferredOutfile() . $this->getExtension(); 113 } 114 } 115 116 function getExtension() 117 { 118 return $this->formatter->getExtension(); 119 } 120 121 function getFormatter() 122 { 123 return $this->formatter; 124 } 61 125 } 62 126 ?> -
trunk/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php
r1186 r1953 33 33 { 34 34 private $inner = ""; 35 35 36 36 function getExtension() 37 37 { 38 38 return ".txt"; 39 39 } 40 40 41 41 function getPreferredOutfile() 42 42 { … … 47 47 { 48 48 parent::paintCaseStart($test_name); 49 49 50 50 $this->inner = ""; 51 51 } 52 52 53 53 function paintCaseEnd($test_name) 54 54 { 55 55 parent::paintCaseEnd($test_name); 56 56 57 57 /* Only count suites where more than one test was run */ 58 58 if ($this->getRunCount()) 59 59 { 60 $sb .= "Testsuite: $test_name\n";60 $sb = "Testsuite: $test_name\n"; 61 61 $sb.= "Tests run: " . $this->getRunCount(); 62 62 $sb.= ", Failures: " . $this->getFailureCount(); … … 76 76 { 77 77 parent::paintError($message); 78 78 79 79 $this->formatError("ERROR", $message); 80 80 } … … 83 83 { 84 84 parent::paintFail($message); 85 85 86 86 $this->formatError("FAILED", $message); 87 87 } … … 90 90 { 91 91 $this->inner.= $this->getTestName() . " " . $type . "\n"; 92 $this->inner.= $message . "\n"; 92 $this->inner.= $message . "\n"; 93 93 } 94 94 } -
trunk/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestResultFormatter.php
r1186 r1953 20 20 */ 21 21 22 require_once 'simpletest/scorer.php';22 //require_once 'simpletest/scorer.php'; 23 23 24 24 require_once 'phing/system/io/Writer.php'; … … 35 35 { 36 36 protected $out = NULL; 37 37 38 38 protected $project = NULL; 39 39 40 40 private $timer = NULL; 41 41 42 42 private $runCount = 0; 43 43 44 44 private $failureCount = 0; 45 46 private $errorCount = 0; 45 46 private $errorCount = 0; 47 47 48 48 private $currentTest = ""; 49 49 50 50 /** 51 51 * Sets the writer the formatter is supposed to write its results to. … … 53 53 function setOutput(Writer $out) 54 54 { 55 $this->out = $out; 55 $this->out = $out; 56 56 } 57 57 … … 75 75 $this->project = $project; 76 76 } 77 77 78 78 function getPreferredOutfile() 79 79 { 80 80 return ""; 81 81 } 82 82 83 83 function paintMethodStart($test_name) 84 84 { 85 85 parent::paintMethodStart($test_name); 86 86 87 87 $this->currentTest = $test_name; 88 88 } 89 89 90 90 function paintMethodEnd($test_name) 91 91 { 92 92 parent::paintMethodEnd($test_name); 93 93 94 94 $this->runCount++; 95 95 } 96 96 97 97 function paintCaseStart($test_name) 98 98 { 99 99 parent::paintCaseStart($test_name); 100 100 101 101 $this->runCount = 0; 102 102 $this->failureCount = 0; 103 103 $this->errorCount = 0; 104 104 105 105 $this->timer = new Timer(); 106 106 $this->timer->start(); 107 107 } 108 108 109 109 function paintCaseEnd($test_name) 110 110 { 111 111 parent::paintCaseEnd($test_name); 112 112 113 113 $this->timer->stop(); 114 114 } … … 117 117 { 118 118 parent::paintError($message); 119 119 120 120 $this->errorCount++; 121 121 } … … 124 124 { 125 125 parent::paintFail($message); 126 126 127 127 $this->failureCount++; 128 128 } … … 132 132 return $this->runCount; 133 133 } 134 134 135 135 function getFailureCount() 136 136 { 137 137 return $this->failureCount; 138 138 } 139 139 140 140 function getErrorCount() 141 141 { 142 142 return $this->errorCount; 143 143 } 144 144 145 145 function getTestName() 146 146 { 147 147 return $this->currentTest; 148 148 } 149 149 150 150 function getElapsedTime() 151 151 { -
trunk/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php
r1186 r1953 35 35 { 36 36 parent::paintCaseEnd($test_name); 37 37 38 38 /* Only count suites where more than one test was run */ 39 39 if ($this->getRunCount()) 40 40 { 41 $sb .= "Tests run: " . $this->getRunCount();41 $sb= "Tests run: " . $this->getRunCount(); 42 42 $sb.= ", Failures: " . $this->getFailureCount(); 43 43 $sb.= ", Errors: " . $this->getErrorCount(); -
trunk/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php
r1186 r1953 42 42 private $printsummary = false; 43 43 private $testfailed = false; 44 private $filesets=array(); 44 45 45 46 /** … … 50 51 */ 51 52 function init() { 52 @include_once 'simpletest/scorer.php'; 53 53 54 54 if (!class_exists('SimpleReporter')) { 55 55 throw new BuildException("SimpleTestTask depends on SimpleTest package being installed.", $this->getLocation()); 56 56 } 57 58 require_once 'simpletest/reporter.php';59 require_once 'simpletest/xml.php';60 require_once 'simpletest/test_case.php';61 57 require_once 'phing/tasks/ext/simpletest/SimpleTestCountResultFormatter.php'; 62 58 require_once 'phing/tasks/ext/simpletest/SimpleTestFormatterElement.php'; 63 59 } 64 60 65 61 function setFailureproperty($value) 66 62 { 67 63 $this->failureproperty = $value; 68 64 } 69 65 70 66 function setErrorproperty($value) 71 67 { 72 68 $this->errorproperty = $value; 73 69 } 74 70 75 71 function setHaltonerror($value) 76 72 { … … 87 83 $this->printsummary = $printsummary; 88 84 } 89 85 90 86 /** 91 87 * Add a new formatter to all tests of this task. … … 145 141 { 146 142 $group = new GroupTest(); 147 143 148 144 $filenames = $this->getFilenames(); 149 145 150 146 foreach ($filenames as $testfile) 151 147 { 152 148 $group->addTestFile($testfile); 153 149 } 154 150 155 151 if ($this->printsummary) 156 152 { … … 160 156 $this->formatters[] = $fe; 161 157 } 162 158 163 159 foreach ($this->formatters as $fe) 164 160 { … … 169 165 { 170 166 $destFile = new PhingFile($fe->getToDir(), $fe->getOutfile()); 171 167 172 168 $writer = new FileWriter($destFile->getAbsolutePath()); 173 169 … … 179 175 } 180 176 } 181 177 182 178 $this->execute($group); 183 179 184 180 if ($this->testfailed) 185 181 { … … 187 183 } 188 184 } 189 185 190 186 private function execute($suite) 191 187 { … … 193 189 $reporter = new MultipleReporter(); 194 190 $reporter->attachReporter($counter); 195 191 196 192 foreach ($this->formatters as $fe) 197 193 { … … 199 195 200 196 $reporter->attachReporter($formatter); 201 } 202 197 } 198 203 199 $suite->run($reporter); 204 200 205 201 $retcode = $counter->getRetCode(); 206 202 207 203 if ($retcode == SimpleTestCountResultFormatter::ERRORS) 208 204 { … … 211 207 $this->project->setNewProperty($this->errorproperty, true); 212 208 } 213 209 214 210 if ($this->haltonerror) 215 211 { … … 223 219 $this->project->setNewProperty($this->failureproperty, true); 224 220 } 225 221 226 222 if ($this->haltonfailure) 227 223 {
