phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

How to test private method?

Open log0 opened this issue 14 years ago • 2 comments

Hi all,

How do I test a private method in via PHPUnit? Currently, I found that I must turn the method into public into to test it. Thanks.

p.s. Please do not suggest not testing the private method, thank you.

log0 avatar Feb 02 '12 13:02 log0

This is not a support forum, sorry. Have a look at http://sebastian-bergmann.de/archives/881-Testing-Your-Privates.html

sebastianbergmann avatar Feb 02 '12 13:02 sebastianbergmann

If you need help please ask on the irc channel or on any forum. We can't provide help for phpunit users in that way. http://stackoverflow.com/questions/5010300/best-practices-to-test-protected-methods-with-phpunit-on-abstract-classes

edorian avatar Feb 02 '12 13:02 edorian