Tip 62: "Test early. Test often. Test Automatically."
The Pragmatic Programmer, Tip 49: "Test your software, or your users will."
PressTest is a WordPress plugin aimed at simplifying writing unit tests for Plugins. It integrates phpUnit and qUnit within WordPress, allowing you to test your plugins without leaving the comfort of your browser -- or having to create a fresh install.
Drop your plugin's unit tests into a ptest folder within the plugin's root directory (at the moment only the 1st level of the directory is tested for tests) and a link will appear on the Plugins page to run tests.
At the moment, PressTest provides a file that mocks all core functions in WordPress, all of which call a 'mime' to imitate the function as required by you. Read the internal documentation in the file pt-mime.php to see how to customize mocked function and class behaviour. Tests for PT_Mime at ptests/PT_Mime_Test.php will further help in understanding usage.
Note: This plugin follows semantic tagging -- in short, consider all versions starting as 0.x unstable; feature releases incrementing by .x, bugfix releases by .0x and backwards incompatible changes with x.00.
Requires: WordPress 3.2 or higher
Compatible up to: WordPress 3.2.1
Last Updated: 2011-10-2
Active Installs: Less than 10
Got something to say? Need help?