Re: Re: [PHPUnit] testing protected functions
| From: | Paul Scott | Date: | Fri, 07 Apr 2006 09:47:48 +0000 |
| Subject: | Re: Re: [PHPUnit] testing protected functions | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23567@lists.php.net to get a copy of this message | ||
On Fri, 2006-04-07 at 11:40 +0200, Sebastian Bergmann wrote:
> Ron Rademaker schrieb:
> > Is it somehow possible to test protected functions with PHPUnit2?
>
> No.
LOL, simple answer to a simple question?
Ron, when doing unit tests, half the point is that you only test your
public functions. The way that I do it, is to write the tests first, and
when the pass, ship the code. Basically you should have a bunch of tests
for your public API written, running constantly on a cron. You then
start writing the public functions and get them to use private and
protected functions as they *need* to. Once your public API passes all
tests, it works, so you ship it. Who cares how your private/protected
methods work? as long as they work!
I would recommend reading up a bit on TDD then asking this question
again...
--Paul