Skip to content

Commit eb584b2

Browse files
authored
Upgrade docker image to PHP 8.1 (#9146)
1 parent 0bd29ce commit eb584b2

File tree

10 files changed

+61
-55
lines changed

10 files changed

+61
-55
lines changed

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
woocommerce: [ 'latest' ]
1919
wordpress: [ 'latest' ]
20-
php: [ '7.4' ]
20+
php: [ '7.4', '8.1' ]
2121
directory: [ 'includes', 'src' ]
2222
env:
2323
WP_VERSION: ${{ matrix.wordpress }}
@@ -36,6 +36,6 @@ jobs:
3636
with:
3737
php-version: ${{ matrix.php }}
3838
tools: composer
39-
coverage: xdebug2
39+
coverage: xdebug
4040
# run CI checks
4141
- run: bash bin/run-ci-tests-check-coverage.bash

bin/check-test-coverage.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ docker compose exec -u www-data wordpress \
1717

1818
echo "Checking coverage..."
1919

20-
docker compose exec -u www-data wordpress \
21-
php -d xdebug.remote_autostart=on \
22-
/var/www/html/wp-content/plugins/woocommerce-payments/vendor/bin/phpunit \
23-
--configuration "/var/www/html/wp-content/plugins/woocommerce-payments/$CONFIGURATION_FILE" \
24-
--coverage-html /var/www/html/php-test-coverage \
25-
--coverage-clover /var/www/html/clover.xml
20+
docker-compose exec -u www-data wordpress \
21+
/var/www/html/wp-content/plugins/woocommerce-payments/vendor/bin/phpunit \
22+
--configuration "/var/www/html/wp-content/plugins/woocommerce-payments/$CONFIGURATION_FILE" \
23+
--coverage-html /var/www/html/php-test-coverage \
24+
--coverage-clover /var/www/html/clover.xml
2625

2726
./vendor/bin/coverage-check docker/wordpress/clover.xml $COVERAGE

bin/run-tests.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ if $WATCH_FLAG; then
2424
# Change directory to WooCommerce Payments' root in order to have access to .phpunit-watcher.yml
2525
docker compose exec -u www-data wordpress bash -c \
2626
"cd /var/www/html/wp-content/plugins/woocommerce-payments && \
27-
php -d xdebug.remote_autostart=on \
2827
./vendor/bin/phpunit-watcher watch --configuration ./phpunit.xml.dist $*"
2928
else
3029
echo "Running the tests..."
3130

32-
docker compose exec -u www-data wordpress \
33-
php -d xdebug.remote_autostart=on \
31+
docker-compose exec -u www-data wordpress \
3432
/var/www/html/wp-content/plugins/woocommerce-payments/vendor/bin/phpunit \
3533
--configuration /var/www/html/wp-content/plugins/woocommerce-payments/phpunit.xml.dist \
3634
$*
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Significance: patch
2+
Type: dev
3+
Comment: Upgrade local dev env to PHP8.1
4+
5+

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"woocommerce/action-scheduler": "3.1.6",
3636
"kalessil/production-dependencies-guard": "dev-master",
3737
"vimeo/psalm": "4.13.1",
38-
"php-stubs/wordpress-stubs": "5.8.2",
38+
"php-stubs/wordpress-stubs": "5.9.6",
3939
"php-stubs/woocommerce-stubs": "6.8.0",
4040
"rregeer/phpunit-coverage-check": "0.3.1",
4141
"yoast/phpunit-polyfills": "1.1.0",

composer.lock

Lines changed: 32 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
dockerfile: ./docker/wordpress_xdebug/Dockerfile
1010
args:
1111
- XDEBUG_REMOTE_PORT=9000 # IDE/Editor's listener port
12+
- XDEBUG_START_WITH_REQUEST=trigger
1213
container_name: woocommerce_payments_wordpress
1314
image: woocommerce_payments_wordpress
1415
restart: always

docker/wordpress_xdebug/Dockerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
FROM wordpress:php7.4
1+
FROM wordpress:php8.1
22
ARG XDEBUG_REMOTE_PORT
33
ARG XDEBUG_REMOTE_HOST=host.docker.internal
4-
RUN pecl install xdebug-2.9.8 \
5-
&& echo 'xdebug.remote_enable=1' >> $PHP_INI_DIR/php.ini \
6-
&& echo "xdebug.remote_port=$XDEBUG_REMOTE_PORT" >> $PHP_INI_DIR/php.ini \
7-
&& echo "xdebug.remote_host=$XDEBUG_REMOTE_HOST" >> $PHP_INI_DIR/php.ini \
8-
&& echo 'xdebug.remote_autostart=0' >> $PHP_INI_DIR/php.ini \
9-
&& docker-php-ext-enable xdebug
4+
ARG XDEBUG_START_WITH_REQUEST=trigger
5+
RUN pecl install xdebug \
6+
&& echo 'xdebug.mode=coverage,debug' >> $PHP_INI_DIR/php.ini \
7+
&& echo "xdebug.client_port=${XDEBUG_REMOTE_PORT}" >> $PHP_INI_DIR/php.ini \
8+
&& echo "xdebug.client_host=${XDEBUG_REMOTE_HOST}" >> $PHP_INI_DIR/php.ini \
9+
&& echo "xdebug.start_with_request=${XDEBUG_START_WITH_REQUEST}" >> $PHP_INI_DIR/php.ini \
10+
&& docker-php-ext-enable xdebug
1011
RUN apt-get update \
11-
&& apt-get install --assume-yes --quiet --no-install-recommends gnupg2 subversion mariadb-client less jq
12-
RUN apt-get install -y openssh-client
12+
&& apt-get install --assume-yes --quiet --no-install-recommends gnupg2 subversion mariadb-client less jq openssh-client
1313
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
1414
&& chmod +x wp-cli.phar \
1515
&& mv wp-cli.phar /usr/local/bin/wp

includes/multi-currency/CurrencySwitcherBlock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function init_block_widget() {
6565
register_block_type(
6666
'woocommerce-payments/multi-currency-switcher',
6767
[
68-
'api_version' => 2,
68+
'api_version' => '2',
6969
'editor_script' => 'woocommerce-payments/multi-currency-switcher',
7070
'render_callback' => [ $this, 'render_block_widget' ],
7171
'attributes' => [

includes/multi-currency/wc-payments-multi-currency.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ function wcpay_multi_currency_onboarding_check() {
1515

1616
// Skip checking the HTTP referer if it is a cron job.
1717
if ( ! defined( 'DOING_CRON' ) ) {
18-
$http_referer = sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ?? '' ) );
19-
$is_setup_page = 0 < strpos( $http_referer, 'multi-currency-setup' );
18+
$http_referer = sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ?? '' ) );
19+
if ( ! empty( $http_referer ) ) {
20+
$is_setup_page = strpos( $http_referer, 'multi-currency-setup' ) !== false;
21+
}
2022
}
2123

2224
return $is_setup_page;

0 commit comments

Comments
 (0)