Page 1 of 1

Modify Simpletest's HTML Reporter

Posted: Wed Aug 30, 2006 11:19 am
by Ollie Saunders
OK I have a failing error like this:
Fail: OF/Testing/TestOfClassEnc.php -> TestOfEnc -> testStrPad -> Equal expectation fails at character 13 with [<IñtërnëT>] and [<IñtërnëT> ] at [/osis/lib/code/php/OF/Testing/TestOfClassEnc.php line 53
Obviously its really difficult to see what the difference is because the browser removes whitespace. So what I'd like to do is modify the reporter to output each character as a list item with some special whitespace characters highlighted somehow. Like this:
Fail: OF/Testing/TestOfClassEnc.php -> TestOfEnc -> testStrPad -> Equal expectation fails at character 13 with [<|I|ñ|t|ë|r|n|ë|T|>] and [<|I|ñ|t|ë|r|n|ë|T|>|sp|\n] at [/osis/lib/code/php/OF/Testing/TestOfClassEnc.php line 53
Only it'll be better because it'll be formatted with HTML and CSS

I've had a look at the source code and I'm damned if I can work out where to go to change this stuff.

Posted: Wed Aug 30, 2006 2:18 pm
by Ambush Commander
The relevant code is in dumper.php. Specific function is _describeStringDifference()

Posted: Wed Aug 30, 2006 2:39 pm
by Ollie Saunders
Great thanks.

Edit: uh no there's no way I can modify this, its written so as to be complete unmodifyable!
_describeStringDifference() is called by describeDifference() which is called from 7 different places and is escaped somewher so you can't add any HTML.

Posted: Thu Sep 14, 2006 10:12 am
by lastcraft
Hi...
ole wrote:Edit: uh no there's no way I can modify this, its written so as to be complete unmodifyable!
_describeStringDifference() is called by describeDifference() which is called from 7 different places and is escaped somewher so you can't add any HTML.
Yeah, sorry :(. The system of error messages needs a bit of a rethink...or even a think. It's a gnarly bit that grew of it's own accord. Mail me the kind of thing you want to happen, so that I can incorporate it in the next release.

My biggest problem is how to make the dumper type stuff overrideabe without complicating the testing interface. One option is something really crude like...

Code: Select all

SimpleTest::setDumper($dumper);
...but that won't survive the first refactor. If I can build a language of things people want to do, I can then decompose Dumper into something that easier to change. Hence why I need you to describe the problem ;).

yours, Marcus

Posted: Thu Sep 14, 2006 2:05 pm
by Ollie Saunders
Sending you a pm marcus.

Posted: Fri Sep 15, 2006 2:07 am
by Chris Corbyn
The sort of "diff" display that trac uses would be neat :)