What’s the proper method of installing a plugin during unit testing?


I am testing a plugin that depends on WooCommerce. In order to properly test the integration, I need WooCommerce installed in the WordPress test application.

I tried installing the plugin using wp-cli via the install_wp_tests script:

wp plugin install woocommerce --activate --allow-root --path=$WP_CORE_DIR

This kicks out an error:

Error: 'wp-config.php' not found.

From what I can tell, the test configuration file is in /tmp/wordpress-tests-lib/wp-tests-config.php. From reading the wp-cli docs, I don’t see any method to specify the path to the configuration file.

How can I install WooCommerce during my test setup process?

Ben Harold 1 year 2020-07-13T02:10:39-05:00 0 Answers 58 views 0

Leave an answer