2021-02-22 02:16:59 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2021-02-23 05:30:49 +00:00
|
|
|
* Plugin Name: WooCommerce Admin Test Helper
|
|
|
|
* Plugin URI: https://github.com/woocommerce/woocommerce-admin-test-helper
|
|
|
|
* Description: A helper plugin to assist with testing WooCommerce Admin
|
|
|
|
* Author: WooCommerce
|
|
|
|
* Author URI: https://woocommerce.com/
|
2022-05-10 23:30:15 +00:00
|
|
|
* Version: 0.7.3
|
2021-02-22 02:16:59 +00:00
|
|
|
*
|
2021-02-23 05:30:49 +00:00
|
|
|
* @package WooCommerce\Admin\TestHelper
|
2021-02-22 02:16:59 +00:00
|
|
|
*/
|
|
|
|
|
2021-02-28 09:02:27 +00:00
|
|
|
define( 'WC_ADMIN_TEST_HELPER_PLUGIN_FILE', 'woocommerce-admin-test-helper/woocommerce-admin-test-helper.php' );
|
|
|
|
|
2021-02-22 02:16:59 +00:00
|
|
|
/**
|
|
|
|
* Register the JS.
|
|
|
|
*/
|
|
|
|
function add_extension_register_script() {
|
|
|
|
$script_path = '/build/index.js';
|
|
|
|
$script_asset_path = dirname( __FILE__ ) . '/build/index.asset.php';
|
|
|
|
$script_asset = file_exists( $script_asset_path )
|
|
|
|
? require( $script_asset_path )
|
|
|
|
: array( 'dependencies' => array(), 'version' => filemtime( $script_path ) );
|
|
|
|
$script_url = plugins_url( $script_path, __FILE__ );
|
|
|
|
|
|
|
|
wp_register_script(
|
2021-02-23 05:30:49 +00:00
|
|
|
'woocommerce-admin-test-helper',
|
2021-02-22 02:16:59 +00:00
|
|
|
$script_url,
|
|
|
|
$script_asset['dependencies'],
|
|
|
|
$script_asset['version'],
|
|
|
|
true
|
|
|
|
);
|
2021-02-28 09:02:27 +00:00
|
|
|
wp_enqueue_script( 'woocommerce-admin-test-helper' );
|
|
|
|
|
|
|
|
$css_file_version = filemtime( dirname( __FILE__ ) . '/build/index.css' );
|
|
|
|
|
|
|
|
wp_register_style(
|
|
|
|
'wp-components',
|
|
|
|
plugins_url( 'dist/components/style.css', WC_ADMIN_TEST_HELPER_PLUGIN_FILE ),
|
|
|
|
array(),
|
|
|
|
$css_file_version
|
|
|
|
);
|
2021-02-22 02:16:59 +00:00
|
|
|
|
|
|
|
wp_register_style(
|
2021-02-23 05:30:49 +00:00
|
|
|
'woocommerce-admin-test-helper',
|
2021-02-22 02:16:59 +00:00
|
|
|
plugins_url( '/build/index.css', __FILE__ ),
|
|
|
|
// Add any dependencies styles may have, such as wp-components.
|
2021-02-26 03:48:05 +00:00
|
|
|
array(
|
2021-02-28 09:02:27 +00:00
|
|
|
'wp-components'
|
2021-02-26 03:48:05 +00:00
|
|
|
),
|
2021-02-28 09:02:27 +00:00
|
|
|
$css_file_version
|
2021-02-22 02:16:59 +00:00
|
|
|
);
|
2021-03-03 06:05:45 +00:00
|
|
|
|
2021-02-23 05:30:49 +00:00
|
|
|
wp_enqueue_style( 'woocommerce-admin-test-helper' );
|
2021-02-22 02:16:59 +00:00
|
|
|
}
|
|
|
|
|
2022-04-12 16:45:04 +00:00
|
|
|
add_action( 'plugins_loaded', function() {
|
|
|
|
if ( ! defined( 'WC_PLUGIN_FILE' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action( 'admin_enqueue_scripts', 'add_extension_register_script' );
|
|
|
|
|
|
|
|
// Load the plugin
|
|
|
|
require( 'plugin.php' );
|
|
|
|
});
|
|
|
|
|
2021-02-23 05:30:49 +00:00
|
|
|
|