Hi,
I'm writing a Unit Test for a function that takes a form object and adds elements to it. To test it, I wrote my own class that extends moodleform within the test class itself, and added the same elements as the function is supposed to add, and asserted whether the two were equal. So for example, what I'm doing is similar to this:
$expectedform = new my_form(); $expectedform->addElement('html', 'test data'); $actualform = new my_form(); some_function_that_changes_the_form($actualform); $this->assertEquals($expectedform, $actualform);
Is there a better way to do this?