diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-02-01 21:38:39 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-02-01 21:39:36 +0100 |
commit | 111cd0fe83721506e438b4125a42d6cb0cf28809 (patch) | |
tree | 599ca31936f737dd7a9437b9dc73e3a0638c7d40 /application | |
parent | f7e5037e83266d44baf569e6d7ebcda0813d54bd (diff) |
Test-More: Improve debug output
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rwxr-xr-x | application/third_party/test-more-php/Test-More-OO.php | 19 |
1 files changed, 14 insertions, 5 deletions
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'"); |