Update @wordpress/env to 8.1.1 and re-enable PHP Unit Tests for PHP v 8.1 and 8.2 (https://github.com/woocommerce/woocommerce-blocks/pull/9875)

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
This commit is contained in:
Karol Manijak 2023-09-01 11:07:55 +02:00 committed by GitHub
parent 70aa569254
commit ac7e115c3e
11 changed files with 183 additions and 6437 deletions

View File

@ -80,8 +80,6 @@ jobs:
## ##
- name: Set up PHP - name: Set up PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
with: with:
php-version: '${{ matrix.php }}' php-version: '${{ matrix.php }}'
ini-file: development ini-file: development
@ -89,29 +87,21 @@ jobs:
# Ensure that Composer installs the correct versions of packages. # Ensure that Composer installs the correct versions of packages.
- name: Override PHP version in composer.json - name: Override PHP version in composer.json
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: | run: |
composer config platform.php ${{ matrix.php }} composer config platform.php ${{ matrix.php }}
composer update composer update
- name: Install npm dependencies - name: Install npm dependencies
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: | run: |
npm ci npm ci
npm run build npm run build
- name: Docker debug information - name: Docker debug information
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: | run: |
docker -v docker -v
docker-compose -v docker-compose -v
- name: General debug information - name: General debug information
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: | run: |
npm --version npm --version
node --version node --version
@ -121,26 +111,18 @@ jobs:
locale -a locale -a
- name: Start Docker environment - name: Start Docker environment
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: npm run wp-env start --update run: npm run wp-env start --update
- name: Log running Docker containers - name: Log running Docker containers
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: docker ps -a run: docker ps -a
- name: Docker container debug information - name: Docker container debug information
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: | run: |
npm run wp-env run tests-mysql mysql -- --version npm run wp-env run tests-mysql mysql -- --version
npm run wp-env run tests-wordpress "php --version" npm run wp-env run tests-wordpress php -- --version
npm run wp-env run tests-wordpress "php -m" npm run wp-env run tests-wordpress php -- -m
npm run wp-env run tests-wordpress "php -i" npm run wp-env run tests-wordpress php -- -i
npm run wp-env run tests-wordpress "locale -a" npm run wp-env run tests-wordpress locale -- -a
- name: Run PHPUnit tests - name: Run PHPUnit tests
# 8.1 and 8.2 are temporarily disabled as docker-images for those cause the errors when pipeline is running
if: ${{ matrix.php == '7.4' || matrix.php == '8.0' }}
run: npm run test:php run: npm run test:php

File diff suppressed because it is too large Load Diff

View File

@ -94,7 +94,7 @@
"env:stop": "npm run wp-env stop", "env:stop": "npm run wp-env stop",
"test:help": "wp-scripts test-unit-js --help", "test:help": "wp-scripts test-unit-js --help",
"test:performance": "npm run wp-env:config && cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.performance.config.js -- performance", "test:performance": "npm run wp-env:config && cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.performance.config.js -- performance",
"test:php": "wp-env run --env-cwd='wp-content/plugins/${PWD##*/}' tests-wordpress vendor/bin/phpunit -c phpunit.xml.dist", "test:php": "wp-env run --env-cwd=\"wp-content/plugins/${PWD##*/}\" tests-wordpress vendor/bin/phpunit -- -c phpunit.xml.dist",
"test:update": "wp-scripts test-unit-js --updateSnapshot --config tests/js/jest.config.json", "test:update": "wp-scripts test-unit-js --updateSnapshot --config tests/js/jest.config.json",
"test:watch": "npm run test -- --watch", "test:watch": "npm run test -- --watch",
"ts:check": "tsc --build", "ts:check": "tsc --build",
@ -171,7 +171,7 @@
"@wordpress/e2e-test-utils-playwright": "0.6.0", "@wordpress/e2e-test-utils-playwright": "0.6.0",
"@wordpress/e2e-tests": "^4.6.0", "@wordpress/e2e-tests": "^4.6.0",
"@wordpress/element": "4.20.0", "@wordpress/element": "4.20.0",
"@wordpress/env": "7.0.0", "@wordpress/env": "8.1.1",
"@wordpress/html-entities": "3.24.0", "@wordpress/html-entities": "3.24.0",
"@wordpress/i18n": "4.24.0", "@wordpress/i18n": "4.24.0",
"@wordpress/is-shallow-equal": "4.24.0", "@wordpress/is-shallow-equal": "4.24.0",

View File

@ -7,4 +7,4 @@ head_dir=$(cd "$(dirname "$script_dir")" && cd ../../.. && pwd)
relative_path=${script_dir#$head_dir/} relative_path=${script_dir#$head_dir/}
# Run the main script in the container for better performance. # Run the main script in the container for better performance.
wp-env run tests-cli "bash wp-content/plugins/$relative_path/scripts/index.sh" wp-env run tests-cli -- bash wp-content/plugins/$relative_path/scripts/index.sh

View File

@ -10,7 +10,7 @@ import { test as setup, expect } from '@woocommerce/e2e-playwright-utils';
setup( 'Sets up the block theme', async ( { admin } ) => { setup( 'Sets up the block theme', async ( { admin } ) => {
await cli( await cli(
`npm run wp-env run tests-cli "wp theme install ${ BLOCK_THEME_SLUG } --activate"` `npm run wp-env run tests-cli -- wp theme install ${ BLOCK_THEME_SLUG } --activate`
); );
await admin.page.goto( '/wp-admin/themes.php' ); await admin.page.goto( '/wp-admin/themes.php' );
await expect( await expect(

View File

@ -10,7 +10,7 @@ import { test as setup, expect } from '@woocommerce/e2e-playwright-utils';
setup( 'Sets up the classic theme', async ( { admin } ) => { setup( 'Sets up the classic theme', async ( { admin } ) => {
await cli( await cli(
`npm run wp-env run tests-cli "wp theme install ${ CLASSIC_THEME_SLUG } --activate"` `npm run wp-env run tests-cli -- wp theme install ${ CLASSIC_THEME_SLUG } --activate`
); );
await admin.page.goto( '/wp-admin/themes.php' ); await admin.page.goto( '/wp-admin/themes.php' );
await expect( await expect(

View File

@ -119,11 +119,11 @@ const prepareAttributes = async ( config: FullConfig ) => {
* we need to process more than 1 batch of items. * we need to process more than 1 batch of items.
*/ */
await cli( await cli(
`npm run wp-env run tests-cli wp action-scheduler run --hooks="woocommerce_run_product_attribute_lookup_regeneration_callback"` `npm run wp-env run tests-cli -- wp action-scheduler run --hooks="woocommerce_run_product_attribute_lookup_regeneration_callback"`
); );
await cli( await cli(
`npm run wp-env run tests-cli wp action-scheduler run --hooks="woocommerce_run_product_attribute_lookup_regeneration_callback"` `npm run wp-env run tests-cli -- wp action-scheduler run --hooks="woocommerce_run_product_attribute_lookup_regeneration_callback"`
); );
}; };

View File

@ -18,14 +18,14 @@ export const installPluginFromPHPFile = async ( phpFilePath: string ) => {
await createPluginFromPHPFile( phpFilePath ); await createPluginFromPHPFile( phpFilePath );
const fileName = path.basename( phpFilePath ).replace( '.php', '' ); const fileName = path.basename( phpFilePath ).replace( '.php', '' );
await cli( await cli(
`npm run wp-env run tests-cli "wp plugin install /var/www/html/custom-plugins/${ fileName }.zip --activate"` `npm run wp-env run tests-cli -- wp plugin install /var/www/html/custom-plugins/${ fileName }.zip --activate`
); );
}; };
export const uninstallPluginFromPHPFile = async ( phpFilePath: string ) => { export const uninstallPluginFromPHPFile = async ( phpFilePath: string ) => {
const fileName = path.basename( phpFilePath ).replace( '.php', '' ); const fileName = path.basename( phpFilePath ).replace( '.php', '' );
await cli( await cli(
`npm run wp-env run tests-cli "wp plugin delete ${ fileName }"` `npm run wp-env run tests-cli -- wp plugin delete ${ fileName }`
); );
await cli( `rm ${ __dirname }/${ fileName }.zip` ); await cli( `rm ${ __dirname }/${ fileName }.zip` );
}; };

View File

@ -51,14 +51,14 @@ const templates = {
test.beforeAll( async () => { test.beforeAll( async () => {
await cli( await cli(
'npm run wp-env run tests-cli "wp option update wc_blocks_use_blockified_product_grid_block_as_template false"' 'npm run wp-env run tests-cli -- wp option update wc_blocks_use_blockified_product_grid_block_as_template false'
); );
await deleteAllTemplates( 'wp_template' ); await deleteAllTemplates( 'wp_template' );
} ); } );
test.afterAll( async () => { test.afterAll( async () => {
await cli( await cli(
'npm run wp-env run tests-cli "wp option delete wc_blocks_use_blockified_product_grid_block_as_template"' 'npm run wp-env run tests-cli -- wp option delete wc_blocks_use_blockified_product_grid_block_as_template'
); );
await deleteAllTemplates( 'wp_template' ); await deleteAllTemplates( 'wp_template' );
} ); } );

View File

@ -9,10 +9,10 @@ test.describe(
async () => { async () => {
test.afterAll( async () => { test.afterAll( async () => {
await cli( await cli(
'npm run wp-env run tests-cli "wp option update woocommerce_cart_page_endpoint cart"' 'npm run wp-env run tests-cli -- wp option update woocommerce_cart_page_endpoint cart'
); );
await cli( await cli(
'npm run wp-env run tests-cli "wp option update woocommerce_checkout_page_endpoint checkout"' 'npm run wp-env run tests-cli -- wp option update woocommerce_checkout_page_endpoint checkout'
); );
} ); } );

View File

@ -97,7 +97,7 @@ test.describe( `${ blockData.name } Block - with All products Block`, () => {
test.describe( `${ blockData.name } Block - with PHP classic template`, () => { test.describe( `${ blockData.name } Block - with PHP classic template`, () => {
test.beforeAll( async () => { test.beforeAll( async () => {
await cli( await cli(
'npm run wp-env run tests-cli "wp option update wc_blocks_use_blockified_product_grid_block_as_template false"' 'npm run wp-env run tests-cli -- wp option update wc_blocks_use_blockified_product_grid_block_as_template false'
); );
} ); } );
test.beforeEach( async ( { admin, page, editor } ) => { test.beforeEach( async ( { admin, page, editor } ) => {
@ -172,7 +172,7 @@ test.describe( `${ blockData.name } Block - with PHP classic template`, () => {
test.afterAll( async () => { test.afterAll( async () => {
await cli( await cli(
'npm run wp-env run tests-cli "wp option delete wc_blocks_use_blockified_product_grid_block_as_template"' 'npm run wp-env run tests-cli -- wp option delete wc_blocks_use_blockified_product_grid_block_as_template'
); );
} ); } );
} ); } );