PHPUnit appears to print failed test cases by serializing the expected and actual values, and showing a diff between them. Also, the serialization truncates values with ellipses, hiding information that I want.
Here's an example of the output that PHPUnit produces:
/Foo/Bar/Baz.php:31
8) Foo\Bar\Baz::test with data set #7 ('foo,bar,baz,qux', array(array('foo', 'bar'), array('baz', 'qux')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
- 0 => Array (...)
- 1 => Array (...)
+ 'j' => 16
+ 'args' => Array (...)
)
I want to see the full expected value, and the full actual value. I also want it to expand those ...
elided values. How do I get it to do that?
You can print whatever you want when an assertion fails by passing an additional parameter.
$this->assertEquals($a,$b,print_r($a,true)." does not equal ".print_r($b,true));
According to this issue: https://github.com/sebastianbergmann/phpunit/issues/669, it looks like to be an XDebug issue.
In the source code, isEquals redirects to this: https://github.com/sebastianbergmann/phpunit/blob/58f3a0e212a8df66858f22fc9a58f138bb5a2e9d/src/Util/GlobalState.php#L361, and there is no form of "shortening"
You can test using php -d xdebug.overload_var_dump=0 /usr/bin/phpunit testCase.php
or phpunit -d xdebug.overload_var_dump=0 testCase.php
to overwrite xdebug settings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With