Esempio n. 1
0
 public function __toString()
 {
     $string = parent::__toString();
     if ($this->observable !== null) {
         $assertions = $this->observable->getScore()->getFailAssertions();
         foreach ($assertions as $assertion) {
             if ($assertion['class'] !== get_class($this->observable) || $assertion['method'] !== $this->observable->getCurrentMethod()) {
                 continue;
             }
             $string .= '     ' . $this->colorizer->colorize('Failure: ') . $assertion['fail'] . PHP_EOL;
             $string .= '     ' . $this->colorizer->colorize('File: ') . $assertion['file'] . PHP_EOL;
             $string .= '     ' . $this->colorizer->colorize('Line: ') . $assertion['line'] . PHP_EOL;
             $string .= '     ' . $this->colorizer->colorize('Asserter: ') . $assertion['asserter'] . PHP_EOL;
         }
     }
     return $string . $this->uncompleted;
 }
Esempio n. 2
0
 public function __toString()
 {
     $string = parent::__toString();
     if ($this->observable !== null) {
         $errors = $this->observable->getScore()->getErrors();
         foreach ($errors as $error) {
             if ($error['class'] !== get_class($this->observable) || $error['method'] !== $this->observable->getCurrentMethod()) {
                 continue;
             }
             $string .= '     ' . $this->colorizer->colorize($error['type'] . ': ') . $error['message'] . PHP_EOL;
             if (($line = $error['file'] ?: $error['errorFile']) !== null) {
                 $string .= '     ' . $this->colorizer->colorize('File: ') . ($error['file'] ?: $error['errorFile']) . PHP_EOL;
             }
             if (($line = $error['line'] ?: $error['errorLine']) !== null) {
                 $string .= '     ' . $this->colorizer->colorize('Line: ') . ($error['line'] ?: $error['errorLine']) . PHP_EOL;
             }
         }
     }
     return $string . $this->uncompleted;
 }
Esempio n. 3
0
 public function __toString()
 {
     $string = parent::__toString();
     if ($this->observable !== null) {
         $exceptions = $this->observable->getScore()->getExceptions();
         foreach ($exceptions as $exception) {
             if ($exception['class'] !== get_class($this->observable) || $exception['method'] !== $this->observable->getCurrentMethod()) {
                 continue;
             }
             $lines = explode(PHP_EOL, $exception['value']);
             $string .= '     ' . $this->colorizer->colorize('Exception: ') . array_shift($lines) . PHP_EOL;
             $string .= '     ' . $this->colorizer->colorize(array_shift($lines));
             foreach ($lines as $line) {
                 $string .= PHP_EOL . '       ' . $line;
             }
             $string .= PHP_EOL;
         }
     }
     return $string . $this->uncompleted;
 }