Oops, sorry Karthik, I was too quickly with my answer and didn't answer your question. I just saw the word helper-class and that works on me like a red cloth on a bull...
To answer your question: a TestHelper class is to help testing a class from the outside, making testing more "transparent". Even if it would be possible to reach private methods with it, you are then not testing the interface, but the implementation. So: it is an indication that you are doing something wrong... Of couse you can use it during development or when searching for a bug, but I think the use of private methods in tests also indicate an architectural flaw.
BTW, nice article by our PHP-hero Giorgio Sironi about the Test Helper pattern:
http://css.dzone.com/books/practical-php-testing/practical-php-testing-patterns-51On Saturday, 15 March 2014 08:53:25 UTC+1, Herman Peeren wrote:
On Saturday, 15 March 2014 04:08:25 UTC+1, Karthik Narendran wrote:
Just one question; then why TestHelper class? It was designed for direct access to Private / Protected methods and variables right? And for working with Reflection API.
All those helper-classes with their static methods are in fact a kind of function-libraries. It is a typically procedural coding style, not object oriented. Such helper-classes should be avoided. They are a code-smell, an anti-pattern. And yes: some refactoring to do for that to get rid of them in Joomla...