From 90f14bc07bf8386f0e76a3a9dc923ca425654b09 Mon Sep 17 00:00:00 2001 From: Luis Cano Date: Tue, 8 Aug 2017 12:28:57 -0400 Subject: [PATCH] fixes cakephp/cakephp#11016 --- lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php b/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php index c868580f7..75def3eb4 100644 --- a/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php +++ b/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php @@ -265,7 +265,19 @@ class CakeHtmlReporter extends CakeBaseReporter { echo "
" . $this->_htmlEntities($message->toString());
 
 		if ((is_string($actualMsg) && is_string($expectedMsg)) || (is_array($actualMsg) && is_array($expectedMsg))) {
-			echo "
" . $this->_htmlEntities(PHPUnit_Util_Diff::diff($expectedMsg, $actualMsg)); + + $diffs = ""; + + // PHPUnit 3.7.38 support + if(class_exists('PHPUnit_Util_Diff')) { + $diffs = PHPUnit_Util_Diff::diff($expectedMsg, $actualMsg); + + // PHPUnit 4.x and 5.x support + }else if(class_exists('SebastianBergmann\Diff\Differ')){ + $diffs = (new SebastianBergmann\Diff\Differ())->diff($expectedMsg, $actualMsg); + } + + echo "
" . $this->_htmlEntities($diffs); } echo "
\n";