[TYPO3-dev] Unit tests and method visibility
Niels Pardon
mail at niels-pardon.de
Sun Jul 5 23:09:17 CEST 2009
Hi Francois!
One solution would be to create a test-class which extends the class
you're trying to test and declare the protected method within there as
public.
I think I once read that there is a possibility to access private and
protected stuff via Reflection for testing but couldn't find the
information now.
If you want to get some inspiration on unit tests with TYPO3 you may
want to take a look at the extensions oelib and seminars. We gathered
quite a lot experience with unit tests and TYPO3 extensions.
Greets,
Niels
Francois Suter schrieb:
> Hi all,
>
> I'm trying to design my first unit tests (wow!) and I'm faced with a
> problem. I want to test the result of a method which should logically be
> "protected". But since the test is outside the scope of the class that
> method belongs to, I get a fatal error trying to call it.
>
> Is there a way to design unit tests for protected (or private) methods?
>
> Cheers
>
More information about the TYPO3-dev
mailing list