plugins_dir

This commit is contained in:
Mike Jolley 2019-06-11 12:08:56 +01:00
parent e939c870ce
commit d50e2426df
1 changed files with 10 additions and 2 deletions

View File

@ -52,11 +52,19 @@ class Bootstrap {
* Init unit testing library. * Init unit testing library.
*/ */
public function init() { public function init() {
$this->wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
$this->tests_dir = dirname( __FILE__ ); $this->tests_dir = dirname( __FILE__ );
$this->plugin_dir = dirname( $this->tests_dir ); $this->plugin_dir = dirname( $this->tests_dir );
if ( file_exists( dirname( $this->plugin_dir ) . '/woocommerce/woocommerce.php' ) ) {
// From plugin directory.
$this->plugins_dir = dirname( $this->plugin_dir ); $this->plugins_dir = dirname( $this->plugin_dir );
} else {
// Travis.
$this->plugins_dir = getenv( 'WP_CORE_DIR' ) . 'wp-content/plugins';
}
$this->wc_tests_dir = $this->plugins_dir . '/woocommerce/tests'; $this->wc_tests_dir = $this->plugins_dir . '/woocommerce/tests';
$this->wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
$this->setup_hooks(); $this->setup_hooks();
$this->load_framework(); $this->load_framework();