From 111cd0fe83721506e438b4125a42d6cb0cf28809 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 1 Feb 2017 21:38:39 +0100 Subject: Test-More: Improve debug output Signed-off-by: Florian Pritz --- .../third_party/test-more-php/Test-More-OO.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'application/third_party') diff --git a/application/third_party/test-more-php/Test-More-OO.php b/application/third_party/test-more-php/Test-More-OO.php index aa769e3ee..005c7dc01 100755 --- a/application/third_party/test-more-php/Test-More-OO.php +++ b/application/third_party/test-more-php/Test-More-OO.php @@ -79,19 +79,28 @@ class TestMore extends TestSimple { $result = eval("return (\$thing1 $operator \$thing2);"); return $this->ok($result, $name); - } + } + + private function dumpvar($a) { + ob_start(); + var_dump($a); + $ret = ob_get_clean(); + $ret = preg_replace("/^[^\n]*\n/", "", $ret); + $ret = preg_replace("/\n$/", "", $ret); + return $ret; + } function is ($thing1, $thing2, $name = NULL) { - $pass = $this->_compare ('==',$thing1,$thing2,$name); + $pass = $this->_compare ('===',$thing1,$thing2,$name); if (!$pass) { - $this->diag(" got: '$thing1'", - " expected: '$thing2'"); + $this->diag(" got: ".$this->dumpvar($thing1)."", + " expected: ".$this->dumpvar($thing2).""); } return $pass; } function isnt ($thing1, $thing2, $name = NULL) { - $pass = $this->_compare ('!=',$thing1,$thing2,$name); + $pass = $this->_compare ('!==',$thing1,$thing2,$name); if (!$pass) { $this->diag(" got: '$thing1'", " expected: '$thing2'"); -- cgit v1.2.3-24-g4f1b