PHPSpec and WordPress
You should include /wp-load.php, that will load all of WordPress’ functions, etc.
You should include /wp-load.php, that will load all of WordPress’ functions, etc.
I sometimes use this plugin http://wordpress.org/extend/plugins/duplicator/ it works pretty well if your server enviroment meets it’s requirements. Otherwise, it’s the good ole, mysql dump route that the other guys explained.
Then there’s the Composer approach described here by Steve Grunwell, to load WooCommerce as a development dependency: $ composer require –dev –prefer-source woocommerce/woocommerce where he mentioned doing some composer.json adjustments, like moving WooCommerce under the vendor path: “extra”: { “installer-paths”: { “vendor/{$vendor}/{$name}”: [ “woocommerce/woocommerce” ] } } and include WooCommerce tests in the generated autoloader: … Read more
This class is defined in includes/testcase.php. If you checkout the entire repo, you should have it. To check out the entire repo, you should be running something along the lines of: svn co https://unit-tests.svn.wordpress.org/trunk wordpress-tests
I was working on some tests for code that involved wp_mail() just the other day. I couldn’t find any docs on it either, but I took a look at the source of mock-mailer.php, and everything was rather simple. First, you should understand that WordPress always uses the $phpmailer global to hold an instance of the … Read more
There are many ways to skin a cat and trying to use Selenium with WordPress CLI is new to me. Essentially, WordPress is ‘just’ a dynamic website using a SQL database with some themes and plugin files behind it. Selenium is designed as a frontend browser test tool so keep that in mind for a … Read more
I think that what you are looking for would actually technically be called functional testing, integration testing, or acceptance testing. It sounds like you want to test the behavior of the front-end of your website (or the front-end behavior of a plugin or theme), not each unit of the code itself. You might use a … Read more
There is a bit of personal philosophy that goes into a deployment workflow. It’s not an easy question to answer outright without knowing your experience with servers and version control, your operating system, hosting, client’s experience and tech culture, etc… Here’s a similar question that has a lot of explanation. For content deployment, you can … Read more
Test in isolation When developing a plugin, the best way to test it is without loading the WordPress environment. If you write code that can be easily tested without WordPress, your code becomes better. Every component that is unit tested, should be tested in isolation: when you test a class, you only have to test … Read more
You can set up a default way to shorten the command line and use it as a template for further configurations by changing the default JUnit Run/Debug Configuration template. Then all new Run/Debug configuration you create in project will use the same option. Here is the related blog post about configurable command line shortener option.