Example #1
0
 /**
  * Constructor
  * @param string $code the short code message
  * @param string $message the longer dev-created message
  * @param mixed $outcome the actual outcome
  * @param mixed $should_be the expected outcome
  * @param string $operator the operator used in the comparisson
  */
 public function __construct($code, $message, $outcome, $should_be, $operator)
 {
     $outcome = $this->captureVariable($outcome);
     $should_be = $this->captureVariable($should_be);
     switch (strtolower($code)) {
         case 'assert_true':
             $prefix = 'TRUE assertion got FALSE.';
             break;
         case 'assert_false':
             $prefix = 'FALSE assertion got TRUE.';
             break;
         case 'assert_equal':
             $prefix = 'Equal (==) assertion failed.';
             break;
         case 'assert_not_equal':
             $prefix = 'Not Equal (!=) assertion failed.';
             break;
         case 'assert_identical':
             $prefix = 'Identical (===) assertion failed.';
             break;
         case 'assert_not_identical':
             $prefix = 'Not Identical (!==) assertion failed.';
             break;
         case 'assert_null':
             $prefix = 'NULL assertion failed.';
             break;
         case 'assert_not_null':
             $prefix = 'Not NULL assertion failed.';
             break;
         default:
             $prefix = 'Unkown assertion.';
     }
     if ($message) {
         $message = ' with user message: ' . $message;
     }
     $message = $prefix . ' [' . $outcome . ' ' . $operator . ' ' . $should_be . ']' . $message;
     parent::__construct($code, $message);
 }
Example #2
0
 public final function recordTestSkip(Snap_UnitTestException $e)
 {
     $report = $this->record('skip', $e->getUserMessage(), $this->cullTrace($e->getTrace()));
     $this->addReport($report);
     $this->announceTestSkip($report);
 }