Properties

$is_admin

$is_admin : 

Should we test in admin environment?

$wp_version

$wp_version : 

WordPress version.

Methods

setUpBeforeClass()

setUpBeforeClass() 

tearDownAfterClass()

tearDownAfterClass() 

commit_transaction()

commit_transaction() 

Commit the queries in a transaction.

This function is provided by WordPress only from version 4.1 onwards, but because we still maintain support for WordPress 3.8 for certain plugins, we add this function to make sure plugin tests that requires commit of transactions can still be built against verrsion 3.8.

setUp()

setUp() 

tearDown()

tearDown() 

get_plugin_under_test()

get_plugin_under_test() : array

Get the main plugin under test

Returns

array

get_extra_plugins()

get_extra_plugins() : array

Get a list of extra plugins that should be loaded and activated for testing

This can include fxitures if needed.

Returns

array

get_all_plugins()

get_all_plugins() : array

Get a list of all plugins, including the plugin under test and extra ones

Returns

array

prepare_plugin_directories()

prepare_plugin_directories() 

Prepare plugin directories

This should create symlinks to the plugins' folders from wp-content/plugins directory so that they can be activated and used later on

load_plugins_for_current_process()

load_plugins_for_current_process() 

Load all required plugins for current process

This should be called by extending testcases explicitly. This only loads actual plugins, not fixtures.

pre_option_active_plugins()

pre_option_active_plugins() : array

Filter `pre_option_active_plugins` hook.

Returns

array

prepare_theme_directories()

prepare_theme_directories() 

WordPress 4.7 started to carrying out tests based on a default blank theme. Since this theme is not copied to `wp-content` folder of the test site, when we try to open the site using a browser, the theme is broken because it does not exist.

load_fixtures()

load_fixtures(  $file_name = null) 

This should be used explicitly by extending testcases

Parameters

$file_name

bootstrap_plugin()

bootstrap_plugin() 

get_wp_version()

get_wp_version(  $version = '') : mixed

Get current WP version

If a WP version is provided as the first parameter, check if the current WP version is greater than or equal to that provided version

Parameters

$version

Returns

mixed

uniqid()

uniqid() : string

Returns

string

prepare_default_values()

prepare_default_values() 

Prepare default values including options and active plugins