[wp-hackers] Unit Testing, Yet Another Discussion

Sam Angove sam at rephrase.net
Tue Aug 7 05:48:26 GMT 2007

On 8/3/07, jacobsantos at branson.com <jacobsantos at branson.com> wrote:
> I do not know what your goals were (are), but mine is basically
> rewriting WordPress to be completely OO and only use PHP 5.2+. My
> current classes and the WordPress classes are unit tested in that
> system, (however I'm not finished with the Plugin Model and I've not
> concerned myself with the cache class).

I'd prefer a PHP 5.2+ WordPress, but it seems unlikely to happen
without a fork [1].

[1]: http://photomatt.net/2007/07/13/on-php/

My interest was/is for a couple of reasons:

 1. It'd really help in pin-pointing problems on other platforms.
Users often have problems (sometimes platform-related) that can be
hard to trace. If the user could be told to "run the WP-Test tool and
report the output", they'd be easier to pinpoint.

 2. Preventing regressions.

 3. Make refactoring safer. The general effect is to speed
development, because small changes are easier and major changes (like
a move to OO PHP 5) are possible.

My frustration was partly because #1 dictates a PHP4-compatible suite
but the best tools (e.g. PHPUnit 3) are PHP5 only. #2 is useful, but
in practice most regressions get caught in the current big bang
testing (which sucks, but still). I was really after #3, but it
started looking like the suite would be so complex that maintaining it
would actually *slow* development. (Or, at least, be enough of a
burden that no-one not already convinced that testing is worthwhile
would willingly adopt it.) I'm really hoping to be proven wrong on
that one.

Anyway, it sounds like you've got things well in hand, so I'll butt
out and let you get on with it. Good luck! :)

> I believe I will place the unit tests up on a subversion repository, if
> you are interested. However, it is highly likely that it won't be
> Google. It isn't that I don't like Google Code, well actually it is. I
> just don't like how the interface works

Anywhere is cool, it's just like you said in your earlier message:
there's been talk about testing, but little in the way of actual
tests. It's nothing but good if there's source code available for
people to try out/add to/build from. :)

More information about the wp-hackers mailing list