Unit testing and encapsulation

unzend

New Member
I'm trying to get into unit testing, but there's one thing bothering me.I have a php class which I want to unit test. It takes some parameters, and then spits out HTML. The problem is that the main functionality is calculating some values and conditions, and these I want to test. But I have put this in a private method, because normally, nobody needs to know about this method. But this way I am not possible to unit test the class because I have no means of testing the result of the method.I have found this article about the subject. The conclusion of the article is using reflection to test the private methods.How do you stand against this subject?
 
Back
Top