Merge branch 'trunk' of github.com:woocommerce/woocommerce into add/api-package-coupons
This commit is contained in:
commit
d8cebb5cc1
|
@ -22,19 +22,6 @@ jobs:
|
||||||
path: ${{ steps.build.outputs.zip_path }}
|
path: ${{ steps.build.outputs.zip_path }}
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Add comment
|
|
||||||
uses: actions/github-script@v3
|
|
||||||
if: github.repository_owner == 'woocommerce'
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
script: |
|
|
||||||
github.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
body: ':package: Artifacts ready for [download](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!'
|
|
||||||
})
|
|
||||||
|
|
||||||
e2e-tests-cache:
|
e2e-tests-cache:
|
||||||
name: Set e2e caches for running tests
|
name: Set e2e caches for running tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"pelago/emogrifier": "3.1.0",
|
"pelago/emogrifier": "3.1.0",
|
||||||
"psr/container": "1.0.0",
|
"psr/container": "1.0.0",
|
||||||
"woocommerce/action-scheduler": "3.1.6",
|
"woocommerce/action-scheduler": "3.1.6",
|
||||||
"woocommerce/woocommerce-admin": "2.0.1",
|
"woocommerce/woocommerce-admin": "2.0.2",
|
||||||
"woocommerce/woocommerce-blocks": "4.4.3"
|
"woocommerce/woocommerce-blocks": "4.4.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "95f29b23c1baa50f079597378d1673f1",
|
"content-hash": "f24a600ea103061d766dd7b06c13e8f2",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "automattic/jetpack-autoloader",
|
"name": "automattic/jetpack-autoloader",
|
||||||
|
@ -44,6 +44,9 @@
|
||||||
"GPL-2.0-or-later"
|
"GPL-2.0-or-later"
|
||||||
],
|
],
|
||||||
"description": "Creates a custom autoloader for a plugin or theme.",
|
"description": "Creates a custom autoloader for a plugin or theme.",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.9.1"
|
||||||
|
},
|
||||||
"time": "2021-02-05T19:07:06+00:00"
|
"time": "2021-02-05T19:07:06+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -75,6 +78,9 @@
|
||||||
"GPL-2.0-or-later"
|
"GPL-2.0-or-later"
|
||||||
],
|
],
|
||||||
"description": "A wrapper for defining constants in a more testable way.",
|
"description": "A wrapper for defining constants in a more testable way.",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/Automattic/jetpack-constants/tree/v1.5.1"
|
||||||
|
},
|
||||||
"time": "2020-10-28T19:00:31+00:00"
|
"time": "2020-10-28T19:00:31+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -205,6 +211,10 @@
|
||||||
"zend",
|
"zend",
|
||||||
"zikula"
|
"zikula"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/composer/installers/issues",
|
||||||
|
"source": "https://github.com/composer/installers/tree/v1.10.0"
|
||||||
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"url": "https://packagist.com",
|
"url": "https://packagist.com",
|
||||||
|
@ -279,6 +289,10 @@
|
||||||
"geolocation",
|
"geolocation",
|
||||||
"maxmind"
|
"maxmind"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
|
||||||
|
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.6.0"
|
||||||
|
},
|
||||||
"time": "2019-12-19T22:59:03+00:00"
|
"time": "2019-12-19T22:59:03+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -353,6 +367,10 @@
|
||||||
"email",
|
"email",
|
||||||
"pre-processing"
|
"pre-processing"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/MyIntervals/emogrifier/issues",
|
||||||
|
"source": "https://github.com/MyIntervals/emogrifier"
|
||||||
|
},
|
||||||
"time": "2019-12-26T19:37:31+00:00"
|
"time": "2019-12-26T19:37:31+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -402,6 +420,10 @@
|
||||||
"container-interop",
|
"container-interop",
|
||||||
"psr"
|
"psr"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/container/issues",
|
||||||
|
"source": "https://github.com/php-fig/container/tree/master"
|
||||||
|
},
|
||||||
"time": "2017-02-14T16:28:37+00:00"
|
"time": "2017-02-14T16:28:37+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -493,20 +515,24 @@
|
||||||
],
|
],
|
||||||
"description": "Action Scheduler for WordPress and WooCommerce",
|
"description": "Action Scheduler for WordPress and WooCommerce",
|
||||||
"homepage": "https://actionscheduler.org/",
|
"homepage": "https://actionscheduler.org/",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/woocommerce/action-scheduler/issues",
|
||||||
|
"source": "https://github.com/woocommerce/action-scheduler/tree/master"
|
||||||
|
},
|
||||||
"time": "2020-05-12T16:22:33+00:00"
|
"time": "2020-05-12T16:22:33+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "woocommerce/woocommerce-admin",
|
"name": "woocommerce/woocommerce-admin",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/woocommerce/woocommerce-admin.git",
|
"url": "https://github.com/woocommerce/woocommerce-admin.git",
|
||||||
"reference": "b7e89c48479348847fc97ae8be8c27d068106d04"
|
"reference": "c4ffd90ebc72652f9d1bc8943a56d7723acc5bf4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/b7e89c48479348847fc97ae8be8c27d068106d04",
|
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/c4ffd90ebc72652f9d1bc8943a56d7723acc5bf4",
|
||||||
"reference": "b7e89c48479348847fc97ae8be8c27d068106d04",
|
"reference": "c4ffd90ebc72652f9d1bc8943a56d7723acc5bf4",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -538,7 +564,11 @@
|
||||||
],
|
],
|
||||||
"description": "A modern, javascript-driven WooCommerce Admin experience.",
|
"description": "A modern, javascript-driven WooCommerce Admin experience.",
|
||||||
"homepage": "https://github.com/woocommerce/woocommerce-admin",
|
"homepage": "https://github.com/woocommerce/woocommerce-admin",
|
||||||
"time": "2021-02-12T01:19:48+00:00"
|
"support": {
|
||||||
|
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
|
||||||
|
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.0.2"
|
||||||
|
},
|
||||||
|
"time": "2021-02-25T07:29:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "woocommerce/woocommerce-blocks",
|
"name": "woocommerce/woocommerce-blocks",
|
||||||
|
@ -585,6 +615,10 @@
|
||||||
"gutenberg",
|
"gutenberg",
|
||||||
"woocommerce"
|
"woocommerce"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
|
||||||
|
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v4.4.3"
|
||||||
|
},
|
||||||
"time": "2021-02-11T18:07:48+00:00"
|
"time": "2021-02-11T18:07:48+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -633,6 +667,10 @@
|
||||||
"isolation",
|
"isolation",
|
||||||
"tool"
|
"tool"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
|
||||||
|
"source": "https://github.com/bamarni/composer-bin-plugin/tree/master"
|
||||||
|
},
|
||||||
"time": "2020-05-03T08:27:20+00:00"
|
"time": "2020-05-03T08:27:20+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -648,5 +686,5 @@
|
||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "7.0"
|
"php": "7.0"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "1.1.0"
|
"plugin-api-version": "2.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,9 @@ class WC_Tracker {
|
||||||
// Cart & checkout tech (blocks or shortcodes).
|
// Cart & checkout tech (blocks or shortcodes).
|
||||||
$data['cart_checkout'] = self::get_cart_checkout_info();
|
$data['cart_checkout'] = self::get_cart_checkout_info();
|
||||||
|
|
||||||
|
// WooCommerce Admin info.
|
||||||
|
$data['wc_admin_disabled'] = apply_filters( 'woocommerce_admin_disabled', false ) ? 'yes' : 'no';
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_tracker_data', $data );
|
return apply_filters( 'woocommerce_tracker_data', $data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,6 @@ class WC_Twenty_Twenty_One {
|
||||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||||
|
|
||||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ), 10 );
|
|
||||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ), 10 );
|
|
||||||
|
|
||||||
// This theme doesn't have a traditional sidebar.
|
// This theme doesn't have a traditional sidebar.
|
||||||
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
||||||
|
|
||||||
|
@ -34,7 +31,7 @@ class WC_Twenty_Twenty_One {
|
||||||
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
||||||
|
|
||||||
// Enqueue wp-admin compatibility styles.
|
// Enqueue wp-admin compatibility styles.
|
||||||
add_action( 'admin_enqueue_scripts', array( __CLASS__ , 'enqueue_admin_styles' ) );
|
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_admin_styles' ) );
|
||||||
|
|
||||||
// Register theme features.
|
// Register theme features.
|
||||||
add_theme_support( 'wc-product-gallery-zoom' );
|
add_theme_support( 'wc-product-gallery-zoom' );
|
||||||
|
@ -50,22 +47,6 @@ class WC_Twenty_Twenty_One {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the Twenty Twenty One wrapper.
|
|
||||||
*/
|
|
||||||
public static function output_content_wrapper() {
|
|
||||||
echo '<section id="primary" class="content-area">';
|
|
||||||
echo '<main id="main" class="site-main">';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close the Twenty Twenty One wrapper.
|
|
||||||
*/
|
|
||||||
public static function output_content_wrapper_end() {
|
|
||||||
echo '</main>';
|
|
||||||
echo '</section>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue CSS for this theme.
|
* Enqueue CSS for this theme.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Unit tests for the WC_Tracker class.
|
||||||
|
*
|
||||||
|
* @package WooCommerce\Tests\WC_Tracker.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class WC_Tracker_Test
|
||||||
|
*/
|
||||||
|
class WC_Tracker_Test extends \WC_Unit_Test_Case {
|
||||||
|
/**
|
||||||
|
* Test the tracking of wc_admin being disabled via filter.
|
||||||
|
*/
|
||||||
|
public function test_wc_admin_disabled_get_tracking_data() {
|
||||||
|
$posted_data = null;
|
||||||
|
|
||||||
|
// Test the case for woocommerce_admin_disabled filter returning true.
|
||||||
|
add_filter(
|
||||||
|
'woocommerce_admin_disabled',
|
||||||
|
function( $default ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'pre_http_request',
|
||||||
|
function( $pre, $args, $url ) use ( &$posted_data ) {
|
||||||
|
$posted_data = $args;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
3,
|
||||||
|
10
|
||||||
|
);
|
||||||
|
WC_Tracker::send_tracking_data( true );
|
||||||
|
$tracking_data = json_decode( $posted_data['body'], true );
|
||||||
|
|
||||||
|
// Test the default case of no filter for set for woocommerce_admin_disabled.
|
||||||
|
$this->assertArrayHasKey( 'wc_admin_disabled', $tracking_data );
|
||||||
|
$this->assertEquals( 'yes', $tracking_data['wc_admin_disabled'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the tracking of wc_admin being not disabled via filter.
|
||||||
|
*/
|
||||||
|
public function test_wc_admin_not_disabled_get_tracking_data() {
|
||||||
|
$posted_data = null;
|
||||||
|
// Bypass time delay so we can invoke send_tracking_data again.
|
||||||
|
update_option( 'woocommerce_tracker_last_send', strtotime( '-2 weeks' ) );
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'pre_http_request',
|
||||||
|
function( $pre, $args, $url ) use ( &$posted_data ) {
|
||||||
|
$posted_data = $args;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
3,
|
||||||
|
10
|
||||||
|
);
|
||||||
|
WC_Tracker::send_tracking_data( true );
|
||||||
|
$tracking_data = json_decode( $posted_data['body'], true );
|
||||||
|
|
||||||
|
// Test the default case of no filter for set for woocommerce_admin_disabled.
|
||||||
|
$this->assertArrayHasKey( 'wc_admin_disabled', $tracking_data );
|
||||||
|
$this->assertEquals( 'no', $tracking_data['wc_admin_disabled'] );
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue