Exemple #1
0
 /**
  * Cleans and returns a line. Removes php tag added to make highlight-string
  * work
  * 
  * @param unknown_type $traceline
  * @param unknown_type $relativePosition
  * @param unknown_type $style
  * @return Ambigous <string, mixed>
  */
 protected function getLine($traceline, $relativePosition, $style = 'normal')
 {
     $line = new \Text_Template($this->templateDir() . '/Line.html.dist');
     $code = str_replace(array('<span style="color: #0000BB">&lt;?php&nbsp;</span>', '<code>', '</code>'), '', highlight_string('<?php ' . Backtrace::readLine($traceline['file'], $traceline['line'] + $relativePosition), true));
     $code = preg_replace('/\\n/', '', $code);
     $code = preg_replace('/<span style="color: #0000BB">&lt;\\?php&nbsp;(.*)(<\\/span>+?)/', '$1', $code);
     $line->setVar(array('line' => $traceline['line'] + $relativePosition, 'class' => $style, 'code' => ' ' . $code));
     return $line->render();
 }
Exemple #2
0
 /**
  * Cleans and returns a line. Removes php tag added to make
  * highlight-string work
  * 
  * @param array   $traceline
  * @param integer $relativePosition
  * @param string  $style
  * @return string
  */
 protected function getLine($traceline, $relativePosition, $style = 'normal')
 {
     $code = Backtrace::readLine($traceline['file'], $traceline['line'] + $relativePosition);
     return '    ' . $code . PHP_EOL;
 }
Exemple #3
0
 /**
  * Gets a pretty trace (rspec format)
  * 
  * @param integer $limit
  * @return string
  */
 public function prettyTrace($limit = 3)
 {
     return Backtrace::pretty($this->getTrace(), $limit);
 }
Exemple #4
0
 /**
  * Adds an exception to the formatters
  * 
  * @param \PHPSpec\Specification\Example      $example
  * @param \Exception                          $e
  */
 public function addException(Example $example, \Exception $e)
 {
     $this->getExceptions()->attach($e, $example);
     $this->notify(new ReporterEvent('status', 'E', $example->getSpecificationText(), $e->getMessage(), Backtrace::pretty($e->getTrace()), $e));
     $this->checkFailFast();
 }