You are here

public function ComparisonFailure::getDiff in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/comparator/src/ComparisonFailure.php \SebastianBergmann\Comparator\ComparisonFailure::getDiff()

Return value

string

1 call to ComparisonFailure::getDiff()
ComparisonFailure::toString in vendor/sebastian/comparator/src/ComparisonFailure.php

File

vendor/sebastian/comparator/src/ComparisonFailure.php, line 111

Class

ComparisonFailure
Thrown when an assertion for string equality failed.

Namespace

SebastianBergmann\Comparator

Code

public function getDiff() {
  if (!$this->actualAsString && !$this->expectedAsString) {
    return '';
  }
  $differ = new Differ("\n--- Expected\n+++ Actual\n");
  return $differ
    ->diff($this->expectedAsString, $this->actualAsString);
}