Merge pull request #12943 from woocommerce/fix-unit-tests-bootstrap

Fixed compatibility with 4.7 in tests bootstrap
This commit is contained in:
Mike Jolley 2017-01-23 20:42:39 +00:00 committed by GitHub
commit 086ed58084
1 changed files with 9 additions and 4 deletions

View File

@ -69,17 +69,22 @@ class WC_Unit_Tests_Bootstrap {
*/
public function install_wc() {
// clean existing install first
// Clean existing install first.
define( 'WP_UNINSTALL_PLUGIN', true );
define( 'WC_REMOVE_ALL_DATA', true );
include( $this->plugin_dir . '/uninstall.php' );
WC_Install::install();
// reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
$GLOBALS['wp_roles']->reinit();
// Reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
$GLOBALS['wp_roles']->reinit();
} else {
$GLOBALS['wp_roles'] = null;
wp_roles();
}
echo "Installing WooCommerce..." . PHP_EOL;
echo 'Installing WooCommerce...' . PHP_EOL;
}
/**