| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | class SimpleTestDebugResultFormatter extends SimpleTestResultFormatter |
|---|
| 33 | { |
|---|
| 34 | protected $current_case = ""; |
|---|
| 35 | protected $current_test = ""; |
|---|
| 36 | private $failingTests = array(); |
|---|
| 37 | |
|---|
| 38 | function printFailingTests() { |
|---|
| 39 | foreach ($this->failingTests as $test) { |
|---|
| 40 | $this->out->write($test . "\n"); |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | function paintCaseStart($test_name) |
|---|
| 45 | { |
|---|
| 46 | parent::paintCaseStart($test_name); |
|---|
| 47 | $this->paint( "Testsuite: $test_name\n"); |
|---|
| 48 | $this->current_case = $test_name; |
|---|
| 49 | } |
|---|
| 50 | function paintMethodStart($test_name) |
|---|
| 51 | { |
|---|
| 52 | parent::paintMethodStart($test_name); |
|---|
| 53 | $this->current_test = $test_name; |
|---|
| 54 | |
|---|
| 55 | $msg = " TestCase: $test_name"; |
|---|
| 56 | $this->paint($msg); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | function paint($msg) { |
|---|
| 60 | if ($this->out == null ) { |
|---|
| 61 | print $msg; |
|---|
| 62 | } else { |
|---|
| 63 | $this->out->write($msg); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | function paintMethodEnd($test_name) { |
|---|
| 70 | parent::paintMethodEnd($test_name); |
|---|
| 71 | $this->paint("\n"); |
|---|
| 72 | |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | function paintCaseEnd($test_name) |
|---|
| 76 | { |
|---|
| 77 | parent::paintCaseEnd($test_name); |
|---|
| 78 | $this->current_case = ""; |
|---|
| 79 | |
|---|
| 80 | if ($this->getRunCount() && false) |
|---|
| 81 | { |
|---|
| 82 | $sb.= "Tests run: " . $this->getRunCount(); |
|---|
| 83 | $sb.= ", Failures: " . $this->getFailureCount(); |
|---|
| 84 | $sb.= ", Errors: " . $this->getErrorCount(); |
|---|
| 85 | $sb.= ", Time elapsed: " . $this->getElapsedTime(); |
|---|
| 86 | $sb.= " sec\n"; |
|---|
| 87 | $this->paint($sb); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | function paintError($message) |
|---|
| 93 | { |
|---|
| 94 | parent::paintError($message); |
|---|
| 95 | $this->formatError("ERROR", $message); |
|---|
| 96 | $this->failingTests[] = $this->current_case . "->" . $this->current_test; |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | function paintFail($message) |
|---|
| 100 | { |
|---|
| 101 | parent::paintFail($message); |
|---|
| 102 | $this->formatError("FAILED", $message); |
|---|
| 103 | $this->failingTests[] = $this->current_case . "->" . $this->current_test; |
|---|
| 104 | } |
|---|
| 105 | function paintException($message) |
|---|
| 106 | { |
|---|
| 107 | parent::paintException($message); |
|---|
| 108 | |
|---|
| 109 | $this->failingTests[] = $this->current_case . "->" . $this->current_test; |
|---|
| 110 | $this->formatError("Exception", $message); |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | private function formatError($type, $message) |
|---|
| 116 | { |
|---|
| 117 | |
|---|
| 118 | $this->paint("ERROR: $type: $message"); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | } |
|---|
| 122 | ?> |
|---|