From 0d416f2f9e12f0cd4faa2fe60fea9c6ef5de1821 Mon Sep 17 00:00:00 2001 From: Laura Date: Mon, 30 Sep 2024 12:15:03 +0100 Subject: [PATCH 1/4] Fix Billing Phone ID getter --- src/js/payments-methods/classic/_payment-methods.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/payments-methods/classic/_payment-methods.js b/src/js/payments-methods/classic/_payment-methods.js index e5e8aad4..79e655fa 100644 --- a/src/js/payments-methods/classic/_payment-methods.js +++ b/src/js/payments-methods/classic/_payment-methods.js @@ -47,7 +47,8 @@ const AmazonPayBtn = ( props ) => { return true; } const shippingPhone = document.getElementById( 'shipping-phone' ); - const billingPhone = document.getElementById( 'phone' ); + const billingPhone = document.getElementById( 'billing-phone' ); + if ( ! shippingPhone?.value && ! billingPhone?.value ) { return { type: 'error', From de72a6b476aab504a2c512ebb91b6fe435c14a35 Mon Sep 17 00:00:00 2001 From: Laura Date: Mon, 30 Sep 2024 13:20:16 +0100 Subject: [PATCH 2/4] Fix typo on phpunit tests --- tests/phpunit/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 6789b995..34c9a720 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -32,7 +32,7 @@ function _manually_load_plugin() { $_plugin_dir = dirname( __FILE__ ) . '/../../'; - require_once $_plugins_dir . '../woocommerce/woocommerce.php'; + require_once $_plugin_dir . '../woocommerce/woocommerce.php'; require_once $_plugin_dir . 'woocommerce-gateway-amazon-payments-advanced.php'; require_once $_plugin_dir . 'includes/class-wc-gateway-amazon-payments-advanced-abstract.php'; From 7d469a4a8153753e5f4a549d40fe3f5a766dbce9 Mon Sep 17 00:00:00 2001 From: Morais Junior Date: Tue, 1 Oct 2024 14:50:55 -0300 Subject: [PATCH 3/4] Fix PHP compatibility --- .../class-wc-mocker-gateway-amazon-payments-advanced.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/mockers/class-wc-mocker-gateway-amazon-payments-advanced.php b/tests/phpunit/mockers/class-wc-mocker-gateway-amazon-payments-advanced.php index 655bdd48..d249b97e 100644 --- a/tests/phpunit/mockers/class-wc-mocker-gateway-amazon-payments-advanced.php +++ b/tests/phpunit/mockers/class-wc-mocker-gateway-amazon-payments-advanced.php @@ -23,7 +23,7 @@ class WC_Mocker_Gateway_Amazon_Payments_Advanced extends WC_Gateway_Amazon_Payme * * @param int|string $order_total The order total to be set. */ - public function __construct( int|string $order_total = 50 ) { + public function __construct( $order_total = 50 ) { $this->settings = WC_Amazon_Payments_Advanced_API::get_settings(); self::$order_total = $order_total; From 5143e28d0a5ef5f2e8b7ffc7acaf0eb049adcf55 Mon Sep 17 00:00:00 2001 From: Morais Junior Date: Tue, 1 Oct 2024 17:54:45 -0300 Subject: [PATCH 4/4] Update Node and Fix CI --- .github/workflows/php-unit-on-pr.yml | 10 +++++----- tests/bin/install-phpunit-tests-dependencies.sh | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php-unit-on-pr.yml b/.github/workflows/php-unit-on-pr.yml index 664979c1..6b54af76 100644 --- a/.github/workflows/php-unit-on-pr.yml +++ b/.github/workflows/php-unit-on-pr.yml @@ -20,7 +20,7 @@ jobs: steps: # Checkout the repository - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # PHP setup - name: Setup PHP ${{ matrix.php }} @@ -37,14 +37,14 @@ jobs: # Use node version from .nvmrc - name: Setup NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' # Cache composer dependencies - name: Cache composer dependencies id: composer-cache - uses: actions/cache@v3 + uses: actions/cache@v1 with: path: ./vendor key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }} @@ -52,7 +52,7 @@ jobs: # Cache node dependencies - name: Cache node dependencies id: node-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./node_modules key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} @@ -76,7 +76,7 @@ jobs: # Prepare test environment - name: Prepare test environment run: | - bash tests/bin/install-phpunit-tests-dependencies.sh wc_apa_test root root 127.0.0.1 latest + bash tests/bin/install-phpunit-tests-dependencies.sh wc_apa_test root root 127.0.0.1 latest ${{ matrix.php }} # Run tests - name: Run tests diff --git a/tests/bin/install-phpunit-tests-dependencies.sh b/tests/bin/install-phpunit-tests-dependencies.sh index be649427..b6116935 100755 --- a/tests/bin/install-phpunit-tests-dependencies.sh +++ b/tests/bin/install-phpunit-tests-dependencies.sh @@ -11,6 +11,7 @@ DB_USER=$2 DB_PASS=$3 DB_HOST=${4-localhost} WP_VERSION=${5-latest} +PHP_VERSION=$6 TMPDIR=${TMPDIR-/tmp} TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") @@ -62,9 +63,14 @@ install_wp() { } install_woocommerce() { - WC_VERSION=$(curl https://api.wordpress.org/plugins/info/1.0/woocommerce.json | jq -r '.version') + if [ $PHP_VERSION = "7.3" ]; then + WC_VERSION="8.4.0" + echo "Warning: WooCommerce $WC_VERSION is the latest version compatible with PHP7.3" + else + WC_VERSION=$(curl https://api.wordpress.org/plugins/info/1.0/woocommerce.json | jq -r '.version') + fi - echo "Installing WooCommerce $WC_VERSION" + echo "Installing WooCommerce $WC_VERSION on PHP $PHP_VERSION" cd - download https://downloads.wordpress.org/plugin/woocommerce.$WC_VERSION.zip ../woocommerce.zip unzip -o -qq ../woocommerce.zip -d ../