Skip to content

Commit 2022410

Browse files
author
Ben Thomson
committed
Change display of errors
1 parent f04cd98 commit 2022410

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Presenter.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ protected function printFailures(): void
721721
$this->cli->darkGray()->out($details['errors'][0]['file']);
722722
$this->cli->red()->out($details['errors'][0]['message']);
723723
$this->cli->br();
724-
$this->cli->darkGray()->out('Line ' . $details['errors'][0]['line'] . ' | ' . $line);
724+
$this->cli->out('Line ' . $details['errors'][0]['line'] . ' | ' . $line);
725725

726726
if (isset($details['errors'][0]['diff'])) {
727727
$this->cli->green()->out('Expected: ' . $details['errors'][0]['diff']['expected']);
@@ -773,22 +773,26 @@ protected function printErrors(): void
773773
$first = false;
774774

775775
// Find offending line
776-
$line = $this->getLine($details['errors'][0]['file'], $details['errors'][0]['line']);
776+
$line = $this->getLine($details['errors'][0]->getFile(), $details['errors'][0]->getLine());
777777

778778
if ($this->config['colours']) {
779779
$this->cli->bold()->inline($details['suite'] . '::');
780780
$this->cli->out($details['test']);
781-
$this->cli->darkGray()->out($details['errors'][0]['file']);
782-
$this->cli->red()->out($details['errors'][0]['message']);
781+
$this->cli->darkGray()->out($details['errors'][0]->getFile());
782+
$this->cli->red()->out($details['errors'][0]->getMessage());
783+
$this->cli->br();
784+
$this->cli->out('Line ' . $details['errors'][0]->getLine() . ' | ' . $line);
783785
$this->cli->br();
784-
$this->cli->darkGray()->out('Line ' . $details['errors'][0]['line'] . ' | ' . $line);
786+
$this->cli->darkGray()->out($details['errors'][0]->getTraceAsString());
785787
} else {
786788
$this->cli->inline($details['suite'] . '::');
787789
$this->cli->out($details['test']);
788-
$this->cli->out($details['errors'][0]['file']);
789-
$this->cli->out($details['errors'][0]['message']);
790+
$this->cli->out($details['errors'][0]->getFile());
791+
$this->cli->out($details['errors'][0]->getMessage());
790792
$this->cli->br();
791-
$this->cli->out('Line ' . $details['errors'][0]['line'] . ' | ' . $line);
793+
$this->cli->out('Line ' . $details['errors'][0]->getLine() . ' | ' . $line);
794+
$this->cli->br();
795+
$this->cli->out($details['errors'][0]->getTraceAsString());
792796
}
793797
}
794798
}

0 commit comments

Comments
 (0)