PHPUnit with OutputTestCase - Problem Solved
| From: | Laurent Laville | Date: | Sun, 08 Jul 2007 23:05:42 +0000 |
| Subject: | PHPUnit with OutputTestCase - Problem Solved | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-47278@lists.php.net to get a copy of this message | ||
Sebastien,
With many tests, I suggest you a solution, patch [1] to apply to Extensions/OutputTestCase.php [2]
This patch allow with BC to define and set a function to filter output.
That will give, in my situation an easy solution to remove un sollicited CR chars.
And to finish a little example about PEAR_Info that PASS the unit test (as expected).
Some explain of source code [3]
Line 98 we set the output callback (default is method normalizeOutput of class OutputTestCase), but may be also override in user Test Case class.
Lines 136-138 we get source of expected results, and normalize output (remove CR) line 139.
While line 141 prepare the way to OutputTestCase::runTest method that will retrieve buffer content (ob_get_content) and normalize also it data . See [1].
Feedback will be welcome !
Regards
Laurent Laville
[1] http://pear.laurent-laville.org/pepr/PHPUnit/OutputTestCase.diff
[2] http://pear.laurent-laville.org/pepr/PHPUnit/OutputTestCase.txt
[3] http://pear.laurent-laville.org/pepr/PHPUnit/PEAR_Info_TestCase_Output.html