[Flow] Best way to test protected method

Aimo Kuenkel mail at aimo.cc
Mon Oct 13 15:48:16 CEST 2014


If there's a bug in a protected method, then there will be a public method using it, hence having that bug, too.
In the end (as i understand the 'normal' way of unit testing) it's only a bug if some functionality that you can use from the outside is having that bug (please correct me here if i'm wrong).
If no public method is "inheriting" that bug, it's either not a bug, or the protected method is unused and can be removed anyways.

Can you share the method so we don't misunderstand?

Regards,

Aimo

-----Ursprüngliche Nachricht-----
Von: flow-bounces at lists.typo3.org [mailto:flow-bounces at lists.typo3.org] Im Auftrag von Christian Loock
Gesendet: Montag, 13. Oktober 2014 15:41
An: TYPO3 Flow mailing list
Betreff: Re: [Flow] Best way to test protected method

Well, the contributions doc says that I need to add a unit test to a bugfix, and the bugfix is in a protected method.

Am I supposed to leave it as it is?



Am 13.10.2014 um 15:41 schrieb Aimo Kuenkel:
> Hi Christian,
>
> I've written a testing package to address those issues (https://github.com/econic/Testers/blob/master/Classes/Econic/Testers/Domain/Model/Accessibility.php#L18), but as far as i remember the Flow team generally does not test any non-public code.
> So i think you're done with just testing the public methods.
>
> Regards,
>
> Aimo
>
> -----Ursprüngliche Nachricht-----
> Von: flow-bounces at lists.typo3.org 
> [mailto:flow-bounces at lists.typo3.org] Im Auftrag von Christian Loock
> Gesendet: Montag, 13. Oktober 2014 15:35
> An: flow >> TYPO3 Flow mailing list
> Betreff: [Flow] Best way to test protected method
>
> Hi,
>
> I am currently trying to push a little change to gerrit but am stuck a little on the unit tests. Basically I added a new protected method to a class and now want to test it. I know there are ways to access protected class properties, but is this also possible with methods?
>
> Cheers,
>
> Christian
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow

_______________________________________________
Flow mailing list
Flow at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow


More information about the Flow mailing list