Changeset 20965
- Timestamp:
- 08/09/09 17:44:16 (4 years ago)
- Files:
-
- tools/lime/branches/2.0-experimental/lib/LimeTest.php (modified) (2 diffs)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputArray.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleDetailed.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleSummary.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputCoverage.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputInspectable.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputInterface.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputNone.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputPipe.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputRaw.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputXml.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleDetailedTest.php (modified) (2 diffs)
- tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleSummaryTest.php (modified) (6 diffs)
- tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputInspectableTest.php (modified) (3 diffs)
- tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputPipeTest.php (modified) (4 diffs)
- tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputRawTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/branches/2.0-experimental/lib/LimeTest.php
r20958 r20965 587 587 } 588 588 589 public function error($message)590 {591 $this->output->error($message);592 }593 594 589 public function expect($class, $code = null) 595 590 { … … 633 628 else 634 629 { 635 $message = get_class($exception).': '.$exception->getMessage(); 636 637 $this->output->error($message, $exception->getFile(), $exception->getLine()); 630 $this->output->error($exception); 638 631 } 639 632 tools/lime/branches/2.0-experimental/lib/output/LimeOutputArray.php
r20573 r20965 61 61 } 62 62 63 public function error( $message, $file, $line)63 public function error(Exception $exception) 64 64 { 65 65 } tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleDetailed.php
r20573 r20965 109 109 } 110 110 111 public function error( $message, $file, $line)111 public function error(Exception $exception) 112 112 { 113 113 $this->errors++; 114 114 115 $message .= sprintf("\n(in %s on line %s)", $file, $line); 115 $message = sprintf("%s: %s\n(in %s on line %s)", get_class($exception), 116 $exception->getMessage(), $exception->getFile(), $exception->getLine()); 116 117 117 118 $this->printer->printLargeBox($message, LimePrinter::ERROR); tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleSummary.php
r20573 r20965 125 125 } 126 126 127 public function error( $message, $file, $line)127 public function error(Exception $exception) 128 128 { 129 129 $this->errors++; tools/lime/branches/2.0-experimental/lib/output/LimeOutputCoverage.php
r20573 r20965 32 32 public function warning($message, $file, $line) {} 33 33 34 public function error( $message, $file, $line) {}34 public function error(Exception $exception) {} 35 35 36 36 public function info($message) {} tools/lime/branches/2.0-experimental/lib/output/LimeOutputInspectable.php
r20691 r20965 84 84 } 85 85 86 public function error( $message, $file, $line)86 public function error(Exception $exception) 87 87 { 88 88 $this->errors++; 89 $this->output->error($ message, $file, $line);89 $this->output->error($exception); 90 90 } 91 91 tools/lime/branches/2.0-experimental/lib/output/LimeOutputInterface.php
r20573 r20965 24 24 public function warning($message, $file, $line); 25 25 26 public function error( $message, $file, $line);26 public function error(Exception $exception); 27 27 28 28 public function info($message); tools/lime/branches/2.0-experimental/lib/output/LimeOutputNone.php
r20573 r20965 24 24 public function warning($message, $file, $line) {} 25 25 26 public function error( $message, $file, $line) {}26 public function error(Exception $exception) {} 27 27 28 28 public function info($message) {} tools/lime/branches/2.0-experimental/lib/output/LimeOutputPipe.php
r20488 r20965 93 93 else 94 94 { 95 $this->output->error( $matches[1].$matches[2], $matches[3], $matches[4]);95 $this->output->error(new LimeError($matches[1].$matches[2], $matches[3], $matches[4])); 96 96 } 97 97 tools/lime/branches/2.0-experimental/lib/output/LimeOutputRaw.php
r20573 r20965 55 55 } 56 56 57 public function error( $message, $file, $line)57 public function error(Exception $exception) 58 58 { 59 $this->printCall('error', array($ message, $file, $line));59 $this->printCall('error', array($exception)); 60 60 } 61 61 tools/lime/branches/2.0-experimental/lib/output/LimeOutputXml.php
r20390 r20965 50 50 } 51 51 52 public function error( $message, $file, $line)52 public function error(Exception $exception) 53 53 { 54 return $this->output->error($ message, $file, $line);54 return $this->output->error($exception); 55 55 } 56 56 tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleDetailedTest.php
r20573 r20965 158 158 159 159 // fixtures 160 $printer->printLargeBox(" A very important error\n(in /test/file on line 11)", LimePrinter::ERROR);161 $printer->replay(); 162 // test 163 $output->error( 'A very important error', '/test/file', 11);160 $printer->printLargeBox("LimeError: A very important error\n(in /test/file on line 11)", LimePrinter::ERROR); 161 $printer->replay(); 162 // test 163 $output->error(new LimeError('A very important error', '/test/file', 11)); 164 164 // assertions 165 165 $printer->verify(); … … 320 320 $output->plan(1); 321 321 $output->pass('First test', '/test/file', 11); 322 $output->error( 'Some error', '/test/file', 11);322 $output->error(new LimeError('Some error', '/test/file', 11)); 323 323 $printer->reset(); 324 324 $printer->printBox(' Looks like some errors occurred.', LimePrinter::ERROR); tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleSummaryTest.php
r20955 r20965 95 95 $output->start('/test/script'); 96 96 $output->pass('A passed test', '/test/script', 11); 97 $output->error( 'An error', '/test/script', 22);97 $output->error(new LimeError('An error', '/test/script', 22)); 98 98 $output->pass('A passed test', '/test/script', 33); 99 99 // assertions … … 112 112 $output->start('/test/script'); 113 113 $output->pass('A passed test', '/test/script', 11); 114 $output->error( 'An error', '/test/script', 22);114 $output->error(new LimeError('An error', '/test/script', 22)); 115 115 $output->warning('A warning', '/test/script', 33); 116 116 $output->pass('A passed test', '/test/script', 44); … … 185 185 $output->start('/test/script'); 186 186 $output->pass('A passed test', '/test/script', 11); 187 $output->error( 'An error', '/test/script', 22);187 $output->error(new LimeError('An error', '/test/script', 22)); 188 188 $output->start('/test/script2'); 189 189 // assertions … … 206 206 $output->start('/test/script'); 207 207 $output->pass('A passed test', '/test/script', 11); 208 $output->error( 'An error', '/test/script', 22);208 $output->error(new LimeError('An error', '/test/script', 22)); 209 209 $output->start('/test/script2'); 210 210 $output->pass('A passed test', '/test/script2', 11); … … 252 252 $output->fail('A failed test', '/test/script', 11); 253 253 $output->warning('A warning', '/test/script', 11); 254 $output->error( 'An error', '/test/script', 11);255 $output->error( 'An error', '/test/script', 11);254 $output->error(new LimeError('An error', '/test/script', 11)); 255 $output->error(new LimeError('An error', '/test/script', 11)); 256 256 $output->start('/test/script2'); 257 257 // assertions … … 278 278 $output->start('/test/script4'); 279 279 $output->pass('A passed test', '/test/script', 11); 280 $output->error( 'An error', '/test/script', 11);280 $output->error(new LimeError('An error', '/test/script', 11)); 281 281 $output->start('/test/script5'); 282 282 $output->pass('A passed test', '/test/script', 11); tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputInspectableTest.php
r20691 r20965 53 53 // @Test: getErrors() returns the number of calls to error() 54 54 55 $output->error( 'An error', '/test/script', 11);55 $output->error(new LimeError('An error', '/test/script', 11)); 56 56 $output->pass('A passed test', '/test/script', 11); 57 $output->error( 'An error', '/test/script', 11);57 $output->error(new LimeError('An error', '/test/script', 11)); 58 58 $t->is($output->getErrors(), 2, 'The returned number is correct'); 59 59 … … 76 76 $mock->skip('A skipped test', '/test/script', 11); 77 77 $mock->warning('A warning', '/test/script', 11); 78 $mock->error( 'An error', '/test/script', 11);78 $mock->error(new LimeError('An error', '/test/script', 11)); 79 79 $mock->comment('A comment'); 80 80 $mock->info('An info'); … … 88 88 $output->skip('A skipped test', '/test/script', 11); 89 89 $output->warning('A warning', '/test/script', 11); 90 $output->error( 'An error', '/test/script', 11);90 $output->error(new LimeError('An error', '/test/script', 11)); 91 91 $output->comment('A comment'); 92 92 $output->info('An info'); tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputPipeTest.php
r20488 r20965 14 14 LimeAnnotationSupport::enable(); 15 15 16 $t = new LimeTest(1 2);16 $t = new LimeTest(13); 17 17 18 18 … … 39 39 <?php 40 40 echo serialize(array("plan", array(1, "/test/file")))."\n"; 41 EOF 42 ); 43 // test 44 $connector->connect($file); 45 // assertions 46 $output->verify(); 47 48 49 // @Test: The call to error() is passed 50 51 // fixtures 52 $output->error(new Exception("An exception")); 53 $output->replay(); 54 file_put_contents($file, <<<EOF 55 <?php 56 echo serialize(array("error", array(new Exception("An exception"))))."\n"; 41 57 EOF 42 58 ); … … 165 181 166 182 // fixtures 167 $output->error( "Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'", $file, 1);183 $output->error(new LimeError("Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'", $file, 1)); 168 184 $output->replay(); 169 185 file_put_contents($file, '<?php $1invalidname;'); … … 178 194 // fixtures 179 195 $output->warning("Warning: require(foobar.php): failed to open stream: No such file or directory", $file, 1); 180 $output->error( "Fatal error: require(): Failed opening required 'foobar.php' (include_path='".get_include_path()."')", $file, 1);196 $output->error(new LimeError("Fatal error: require(): Failed opening required 'foobar.php' (include_path='".get_include_path()."')", $file, 1)); 181 197 $output->replay(); 182 198 file_put_contents($file, '<?php require "foobar.php";'); tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputRawTest.php
r20573 r20965 91 91 // test 92 92 ob_start(); 93 $output->error( 'An error', '/test/file', 11);93 $output->error($error = new LimeError('An error', '/test/file', 11)); 94 94 $result = ob_get_clean(); 95 95 // assertions 96 $t->is($result, serialize(array('error', array( 'An error', '/test/file', 11)))."\n", 'The method call is serialized');96 $t->is($result, serialize(array('error', array($error)))."\n", 'The method call is serialized'); 97 97 98 98