Development

Changeset 20965

You must first sign up to be able to contribute.

Changeset 20965

Show
Ignore:
Timestamp:
08/09/09 17:44:16 (5 years ago)
Author:
bschussek
Message:

Modified method signature LimeOutputInterface::error() to accept an Exception object

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/lime/branches/2.0-experimental/lib/LimeTest.php

    r20958 r20965  
    587587  } 
    588588 
    589   public function error($message) 
    590   { 
    591     $this->output->error($message); 
    592   } 
    593  
    594589  public function expect($class, $code = null) 
    595590  { 
     
    633628    else 
    634629    { 
    635       $message = get_class($exception).': '.$exception->getMessage(); 
    636  
    637       $this->output->error($message, $exception->getFile(), $exception->getLine()); 
     630      $this->output->error($exception); 
    638631    } 
    639632 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputArray.php

    r20573 r20965  
    6161  } 
    6262 
    63   public function error($message, $file, $line
     63  public function error(Exception $exception
    6464  { 
    6565  } 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleDetailed.php

    r20573 r20965  
    109109  } 
    110110 
    111   public function error($message, $file, $line
     111  public function error(Exception $exception
    112112  { 
    113113    $this->errors++; 
    114114 
    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()); 
    116117 
    117118    $this->printer->printLargeBox($message, LimePrinter::ERROR); 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleSummary.php

    r20573 r20965  
    125125  } 
    126126 
    127   public function error($message, $file, $line
     127  public function error(Exception $exception
    128128  { 
    129129    $this->errors++; 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputCoverage.php

    r20573 r20965  
    3232  public function warning($message, $file, $line) {} 
    3333 
    34   public function error($message, $file, $line) {} 
     34  public function error(Exception $exception) {} 
    3535 
    3636  public function info($message) {} 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputInspectable.php

    r20691 r20965  
    8484  } 
    8585 
    86   public function error($message, $file, $line
     86  public function error(Exception $exception
    8787  { 
    8888    $this->errors++; 
    89     $this->output->error($message, $file, $line); 
     89    $this->output->error($exception); 
    9090  } 
    9191 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputInterface.php

    r20573 r20965  
    2424  public function warning($message, $file, $line); 
    2525 
    26   public function error($message, $file, $line); 
     26  public function error(Exception $exception); 
    2727 
    2828  public function info($message); 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputNone.php

    r20573 r20965  
    2424  public function warning($message, $file, $line) {} 
    2525 
    26   public function error($message, $file, $line) {} 
     26  public function error(Exception $exception) {} 
    2727 
    2828  public function info($message) {} 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputPipe.php

    r20488 r20965  
    9393        else 
    9494        { 
    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])); 
    9696        } 
    9797 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputRaw.php

    r20573 r20965  
    5555  } 
    5656 
    57   public function error($message, $file, $line
     57  public function error(Exception $exception
    5858  { 
    59     $this->printCall('error', array($message, $file, $line)); 
     59    $this->printCall('error', array($exception)); 
    6060  } 
    6161 
  • tools/lime/branches/2.0-experimental/lib/output/LimeOutputXml.php

    r20390 r20965  
    5050  } 
    5151 
    52   public function error($message, $file, $line
     52  public function error(Exception $exception
    5353  { 
    54     return $this->output->error($message, $file, $line); 
     54    return $this->output->error($exception); 
    5555  } 
    5656 
  • tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleDetailedTest.php

    r20573 r20965  
    158158 
    159159  // 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)); 
    164164  // assertions 
    165165  $printer->verify(); 
     
    320320  $output->plan(1); 
    321321  $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)); 
    323323  $printer->reset(); 
    324324  $printer->printBox(' Looks like some errors occurred.', LimePrinter::ERROR); 
  • tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleSummaryTest.php

    r20955 r20965  
    9595  $output->start('/test/script'); 
    9696  $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)); 
    9898  $output->pass('A passed test', '/test/script', 33); 
    9999  // assertions 
     
    112112  $output->start('/test/script'); 
    113113  $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)); 
    115115  $output->warning('A warning', '/test/script', 33); 
    116116  $output->pass('A passed test', '/test/script', 44); 
     
    185185  $output->start('/test/script'); 
    186186  $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)); 
    188188  $output->start('/test/script2'); 
    189189  // assertions 
     
    206206  $output->start('/test/script'); 
    207207  $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)); 
    209209  $output->start('/test/script2'); 
    210210  $output->pass('A passed test', '/test/script2', 11); 
     
    252252  $output->fail('A failed test', '/test/script', 11); 
    253253  $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)); 
    256256  $output->start('/test/script2'); 
    257257  // assertions 
     
    278278  $output->start('/test/script4'); 
    279279  $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)); 
    281281  $output->start('/test/script5'); 
    282282  $output->pass('A passed test', '/test/script', 11); 
  • tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputInspectableTest.php

    r20691 r20965  
    5353// @Test: getErrors() returns the number of calls to error() 
    5454 
    55   $output->error('An error', '/test/script', 11); 
     55  $output->error(new LimeError('An error', '/test/script', 11)); 
    5656  $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)); 
    5858  $t->is($output->getErrors(), 2, 'The returned number is correct'); 
    5959 
     
    7676  $mock->skip('A skipped test', '/test/script', 11); 
    7777  $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)); 
    7979  $mock->comment('A comment'); 
    8080  $mock->info('An info'); 
     
    8888  $output->skip('A skipped test', '/test/script', 11); 
    8989  $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)); 
    9191  $output->comment('A comment'); 
    9292  $output->info('An info'); 
  • tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputPipeTest.php

    r20488 r20965  
    1414LimeAnnotationSupport::enable(); 
    1515 
    16 $t = new LimeTest(12); 
     16$t = new LimeTest(13); 
    1717 
    1818 
     
    3939<?php 
    4040echo serialize(array("plan", array(1, "/test/file")))."\n"; 
     41EOF 
     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 
     56echo serialize(array("error", array(new Exception("An exception"))))."\n"; 
    4157EOF 
    4258  ); 
     
    165181 
    166182  // 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)); 
    168184  $output->replay(); 
    169185  file_put_contents($file, '<?php $1invalidname;'); 
     
    178194  // fixtures 
    179195  $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)); 
    181197  $output->replay(); 
    182198  file_put_contents($file, '<?php require "foobar.php";'); 
  • tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputRawTest.php

    r20573 r20965  
    9191  // test 
    9292  ob_start(); 
    93   $output->error('An error', '/test/file', 11); 
     93  $output->error($error = new LimeError('An error', '/test/file', 11)); 
    9494  $result = ob_get_clean(); 
    9595  // 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'); 
    9797 
    9898