[wp-hackers] plugins unit testing

Bryan Petty bryan at ibaku.net
Fri Mar 8 07:45:59 UTC 2013

On Thu, Mar 7, 2013 at 8:50 PM, Paolo Tresso <paolo.tresso at swergroup.com> wrote:
> I'm trying to learn unit testing and use it properly in our plugins (about
> time..). First thing I've learned so far is that I need to write better code
> in order to test it :)
> I've managed to setup tests and environment thanks to the *amazing* wp-cli
> but I can't figure out how to test several things.
> Example: one of our plugins deals with uploads filenames; while I can test
> some step and method on debug strings, can I simulate a real file upload
> process and test if my plugins plays nice with every hook? Can I create a
> debug post and test save_post hooks, or this is out of the testing scope?

I'm not entirely sure on file uploads (some of that might need to be
mocked out), but the rest is definitely a yes.

This might help you a little too:

More information about the wp-hackers mailing list