Sebastian Bergmann has posted this new item on his blog today detailing how to tell the differences between two strings inside of PHPUnit 3.
A long-standing feature request for PHPUnit has been the generation of a real diff between strings that span multiple lines.Ideally this would be done by implementing the diff algorithm in PHP. But since Derick needed a working solution quickly, the two of us came up with a "hack": we just use GNU diff and invoke the diff command via shell_exec().
He gives an example, showing how to judge the difference between two strings of HTML in a test. The result catches the differences (inside the body tags) easily.