I am adding unit tests to an old PHP database at work. I will test and rewrite a lot of HTML generation code, and currently I'm just testing if the generated lines are identical to the expected line, for example: (using PHPUnit)
public function testConntype_select() { $this->assertEquals( '<select><option value="blabla">Some text</option></select>', conntype_select(1);
This method has a disadvantage, which is also checked on the ordering of attributes, spaces and many other irrelevant details. I am wondering if there are any better ways to do this. For example, if there are good and easy ways to compare the generated DOM trees. I found very similar questions for ruby but found nothing for PHP.
asbja source share