Fix vendor scripts not autoloading (https://github.com/woocommerce/woocommerce-admin/pull/2907)
* Fix vendor scripts and test bootstrapping * Escape the downloaded file URL in tests * Generate feature config file for tests * Run feature config generation before and after script tests
This commit is contained in:
parent
1d8d0df790
commit
c70c7bfd68
|
@ -3,10 +3,10 @@
|
|||
|
||||
if [ $1 == 'before' ]; then
|
||||
cd "$WP_CORE_DIR/wp-content/plugins/woocommerce-admin/"
|
||||
npm run build:feature-config
|
||||
if [[ ${RUN_PHPCS} == 1 ]]; then
|
||||
composer install
|
||||
else
|
||||
npm run build:feature-config
|
||||
composer install --no-dev
|
||||
fi
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* @package WC_Admin\Functions
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use \Automattic\WooCommerce\Admin\Loader;
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,7 +92,7 @@ class WC_Tests_API_Reports_Downloads extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( $this->user, $download_report['user_id'] );
|
||||
$this->assertEquals( '1.2.3.4', $download_report['ip_address'] );
|
||||
$this->assertEquals( 'help.png', $download_report['file_name'] );
|
||||
$this->assertEquals( plugin_dir_url( __FILE__ ) . 'assets/images/help.png', $download_report['file_path'] );
|
||||
$this->assertEquals( esc_url( plugin_dir_url( __FILE__ ) . 'assets/images/help.png' ), $download_report['file_path'] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,10 +111,9 @@ require_once dirname( __FILE__ ) . '/framework/helpers/class-wc-test-action-queu
|
|||
require_once dirname( __FILE__ ) . '/framework/helpers/class-wc-helper-queue.php';
|
||||
|
||||
/**
|
||||
* Set the environment and feature flags to 'develop' when running tests, instead of what is set in the generated `config/feature-flags.php`.
|
||||
* This matches how we mock the flags in jest.
|
||||
* Use the `development` features for testing.
|
||||
*/
|
||||
function wc_admin_get_feature_config() {
|
||||
function wc_admin_add_development_features() {
|
||||
$config = json_decode( file_get_contents( dirname( dirname( __FILE__ ) ) . '/config/development.json' ) ); // @codingStandardsIgnoreLine.
|
||||
$flags = array();
|
||||
foreach ( $config->features as $feature => $bool ) {
|
||||
|
@ -122,3 +121,4 @@ function wc_admin_get_feature_config() {
|
|||
}
|
||||
return $flags;
|
||||
}
|
||||
tests_add_filter( 'wc_admin_get_feature_config', 'wc_admin_add_development_features' );
|
||||
|
|
Loading…
Reference in New Issue