Add PHP 8.1/8.2 to unit testing matrix (https://github.com/woocommerce/woocommerce-blocks/pull/8757)
* Added PHP 8.1 to unit testing matrix * Refactor unit testing to match Gutenberg repo 🤞 * Removed Gutenberg reference from debug information * Updated image running phpunit binary * Reverted image running phpunit binary * Remove composer platform override * Bump @wordpress/env and include phpunit * Update phpunit and tests * Change prefix * Try admin context when install wc * try wc install * adjust phpunit config file * Updated phpunit.xml.dist, composer.json and package.json * Added PHP 8.1 to unit testing matrix * Refactor unit testing to match Gutenberg repo 🤞 * Removed Gutenberg reference from debug information * Updated image running phpunit binary * Reverted image running phpunit binary * Remove composer platform override * Bump @wordpress/env and include phpunit * Update phpunit and tests * Change prefix * Try admin context when install wc * try wc install * adjust phpunit config file * Updated phpunit.xml.dist, composer.json and package.json * Revert install changes * updated npm packages * updated composer lock * updated check assets flow * Updated check assets flow. Yaml file auto formatted. * Updated check assets flow. * Attempt at fixing E2E * Reverted setup permissions step * Add logging information to E2E * Reverted E2E test flow * test playwright perms fix * test e2e perms fix * test e2e perms fix * test e2e perms fix * test e2e perms fix * languages update & debug * languages update & debug * revert * force "@wordpress/env": "^4.9.0" on E2E * update package lock * update package lock --------- Co-authored-by: Mike Jolley <mike.jolley@me.com> Co-authored-by: Niels Lange <info@nielslange.de>
This commit is contained in:
parent
8de8fc917c
commit
7c25db1c80
|
@ -1,82 +1,91 @@
|
||||||
name: Check Modified Assets
|
name: Check Modified Assets
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-trunk:
|
build-trunk:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: trunk
|
ref: trunk
|
||||||
- name: Cache node_modules
|
|
||||||
id: cache-node-modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
- name: Cache node_modules
|
||||||
uses: actions/setup-node@v3
|
id: cache-node-modules
|
||||||
with:
|
uses: actions/cache@v3
|
||||||
node-version-file: '.nvmrc'
|
env:
|
||||||
cache: 'npm'
|
cache-name: cache-node-modules
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
|
${{ runner.os }}-build-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Setup node version and npm cache
|
||||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
uses: actions/setup-node@v3
|
||||||
run: npm ci --no-optional
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Install Node dependencies
|
||||||
run: npm run build:check-assets
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||||
|
run: npm install --no-optional --no-audit
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Build Assets
|
||||||
uses: actions/upload-artifact@v3
|
run: npm run build:check-assets
|
||||||
with:
|
|
||||||
name: assets-list
|
|
||||||
path: ./build/assets.json
|
|
||||||
|
|
||||||
compare-assets-with-trunk:
|
- name: Upload Artifact
|
||||||
needs: [build-trunk]
|
uses: actions/upload-artifact@v3
|
||||||
runs-on: ubuntu-latest
|
with:
|
||||||
steps:
|
name: assets-list
|
||||||
- uses: actions/checkout@v3
|
path: ./build/assets.json
|
||||||
|
|
||||||
- name: Cache node_modules
|
compare-assets-with-trunk:
|
||||||
id: cache-node-modules
|
needs: [ build-trunk ]
|
||||||
uses: actions/cache@v3
|
runs-on: ubuntu-latest
|
||||||
env:
|
steps:
|
||||||
cache-name: cache-node-modules
|
- uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
- name: Cache node_modules
|
||||||
uses: actions/setup-node@v3
|
id: cache-node-modules
|
||||||
with:
|
uses: actions/cache@v3
|
||||||
node-version-file: '.nvmrc'
|
env:
|
||||||
cache: 'npm'
|
cache-name: cache-node-modules
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
|
${{ runner.os }}-build-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Setup node version and npm cache
|
||||||
run: npm run build:check-assets
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Download assets (trunk)
|
- name: Build Assets
|
||||||
uses: actions/download-artifact@v3
|
run: npm run build:check-assets
|
||||||
with:
|
|
||||||
name: assets-list
|
- name: Download assets (trunk)
|
||||||
path: assets-list
|
uses: actions/download-artifact@v3
|
||||||
- name: Compare Assets
|
with:
|
||||||
uses: ./.github/compare-assets
|
name: assets-list
|
||||||
id: compare-assets
|
path: assets-list
|
||||||
with:
|
- name: Compare Assets
|
||||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
uses: ./.github/compare-assets
|
||||||
compare: assets-list/assets.json
|
id: compare-assets
|
||||||
create-comment: false
|
with:
|
||||||
- name: Append report
|
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
uses: ./.github/comments-aggregator
|
compare: assets-list/assets.json
|
||||||
with:
|
create-comment: false
|
||||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
- name: Append report
|
||||||
section-id: compare-assets-with-trunk
|
uses: ./.github/comments-aggregator
|
||||||
content: ${{steps.compare-assets.outputs.comment}}
|
with:
|
||||||
|
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
section-id: compare-assets-with-trunk
|
||||||
|
content: ${{steps.compare-assets.outputs.comment}}
|
||||||
|
|
|
@ -1,169 +1,175 @@
|
||||||
name: E2E tests
|
name: E2E tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [trunk]
|
branches: [trunk]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
JSE2EWithGutenberg:
|
JSE2EWithGutenberg:
|
||||||
if: ${{ false }} # disable until we've fixed failing tests.
|
if: ${{ false }} # disable until we've fixed failing tests.
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
part: [1, 2, 3, 4, 5]
|
part: [1, 2, 3, 4, 5]
|
||||||
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
|
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Cache node_modules
|
- name: Cache node_modules
|
||||||
id: cache-node-modules
|
id: cache-node-modules
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
env:
|
env:
|
||||||
cache-name: cache-node-modules
|
cache-name: cache-node-modules
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
- name: Setup node version and npm cache
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Install Node Dependencies
|
- name: Install Node Dependencies
|
||||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||||
run: npm ci --no-optional
|
run: npm ci --no-optional
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Build Assets
|
||||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: blocks.ini setup
|
||||||
run: |
|
run: |
|
||||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-composer-
|
${{ runner.os }}-composer-
|
||||||
- name: Set up PHP
|
- name: Set up PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '8.0'
|
||||||
coverage: none
|
coverage: none
|
||||||
tools: composer
|
tools: composer
|
||||||
|
|
||||||
- name: Composer install
|
- name: Composer install
|
||||||
run: |
|
run: |
|
||||||
composer install
|
composer install
|
||||||
- name: E2E Tests (WP latest with Gutenberg plugin)
|
- name: E2E Tests (WP latest with Gutenberg plugin)
|
||||||
env:
|
env:
|
||||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||||
GUTENBERG_EDITOR_CONTEXT: 'gutenberg'
|
GUTENBERG_EDITOR_CONTEXT: 'gutenberg'
|
||||||
run: |
|
run: |
|
||||||
node ./bin/wp-env-with-gutenberg.js
|
node ./bin/wp-env-with-gutenberg.js
|
||||||
npm run wp-env start
|
npm run wp-env start
|
||||||
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
||||||
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
||||||
|
|
||||||
- name: Upload artifacts on failure
|
- name: Upload artifacts on failure
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: e2e-with-gutenberg-test-report-${{matrix.part}}
|
name: e2e-with-gutenberg-test-report-${{matrix.part}}
|
||||||
path: reports/e2e
|
path: reports/e2e
|
||||||
|
|
||||||
- name: Archive flaky tests report
|
- name: Archive flaky tests report
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: flaky-tests-report-${{ matrix.part }}
|
name: flaky-tests-report-${{ matrix.part }}
|
||||||
path: flaky-tests
|
path: flaky-tests
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
|
|
||||||
JSE2ETests:
|
JSE2ETests:
|
||||||
name: JavaScript E2E Tests (latest)
|
name: JavaScript E2E Tests (latest)
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
part: [1, 2, 3, 4, 5]
|
part: [1, 2, 3, 4, 5]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Cache node_modules
|
- name: Cache node_modules
|
||||||
id: cache-node-modules
|
id: cache-node-modules
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
env:
|
env:
|
||||||
cache-name: cache-node-modules
|
cache-name: cache-node-modules
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-modified-build-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-modified-build-${{ env.cache-name }}-
|
||||||
|
${{ runner.os }}-modified-build-
|
||||||
|
${{ runner.os }}-modified-
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
- name: Setup node version and npm cache
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Install Node Dependencies
|
- name: Install Node dependencies
|
||||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||||
run: npm ci --no-optional
|
run: |
|
||||||
|
sed -i 's/"@wordpress\/env": ".*"/"@wordpress\/env": "^4.9.0"/' package.json
|
||||||
|
npm install --no-optional --no-audit
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Build Assets
|
||||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: blocks.ini setup
|
||||||
run: |
|
run: |
|
||||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-composer-
|
${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Set up PHP
|
- name: Set up PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '8.0'
|
||||||
coverage: none
|
coverage: none
|
||||||
tools: composer
|
tools: composer
|
||||||
|
|
||||||
- name: Composer install
|
- name: Composer install
|
||||||
run: |
|
run: |
|
||||||
composer install
|
composer install
|
||||||
|
|
||||||
- name: E2E Tests (WP latest)
|
- name: E2E Tests (WP latest)
|
||||||
env:
|
env:
|
||||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||||
run: |
|
run: |
|
||||||
npm run wp-env start
|
npm run wp-env start
|
||||||
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests
|
||||||
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
|
||||||
|
|
||||||
- name: Upload artifacts on failure
|
- name: Upload artifacts on failure
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: e2e-test-report-${{matrix.part}}
|
name: e2e-test-report-${{matrix.part}}
|
||||||
path: reports/e2e
|
path: reports/e2e
|
||||||
|
|
||||||
- name: Archive flaky tests report
|
- name: Archive flaky tests report
|
||||||
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
|
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: flaky-tests-report-${{ matrix.part }}
|
name: flaky-tests-report-${{ matrix.part }}
|
||||||
path: flaky-tests
|
path: flaky-tests
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
|
|
|
@ -2,7 +2,7 @@ name: Playwright Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [trunk]
|
branches: [ trunk ]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -11,21 +11,51 @@ jobs:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
with:
|
||||||
with:
|
ref: trunk
|
||||||
node-version: 16
|
|
||||||
cache: 'npm' # Cache npm dependencies
|
- name: Cache node_modules
|
||||||
- name: Install dependencies
|
id: cache-node-modules
|
||||||
run: npm ci
|
uses: actions/cache@v3
|
||||||
- name: Load wp-env
|
env:
|
||||||
run: npm run env:start
|
cache-name: cache-node-modules
|
||||||
- name: Install Playwright Browsers
|
with:
|
||||||
run: npx playwright install --with-deps
|
path: node_modules
|
||||||
- name: Run Playwright tests
|
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
|
||||||
run: npx playwright test --config=tests/e2e-pw/playwright.config.ts
|
restore-keys: |
|
||||||
- uses: actions/upload-artifact@v3
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
with:
|
${{ runner.os }}-build-
|
||||||
name: playwright-report
|
${{ runner.os }}-
|
||||||
path: playwright-report/
|
|
||||||
retention-days: 30
|
- name: Setup node version and npm cache
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Node dependencies
|
||||||
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||||
|
run: npm install --no-optional --no-audit
|
||||||
|
|
||||||
|
- name: Load wp-env
|
||||||
|
run: npm run env:start --update
|
||||||
|
|
||||||
|
- name: Fix permissions # We need to figure this out https://github.com/WordPress/gutenberg/issues/22515#issuecomment-1308346256
|
||||||
|
run: |
|
||||||
|
WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1)
|
||||||
|
cd $WP_ENV_DIR
|
||||||
|
mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
|
||||||
|
chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
|
||||||
|
cd -
|
||||||
|
|
||||||
|
- name: Install Playwright Browsers
|
||||||
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
|
- name: Run Playwright tests
|
||||||
|
run: npx playwright test --config=tests/e2e-pw/playwright.config.ts
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: playwright-report
|
||||||
|
path: playwright-report/
|
||||||
|
retention-days: 30
|
||||||
|
|
|
@ -1,163 +1,128 @@
|
||||||
name: Unit tests
|
name: Unit Tests
|
||||||
|
|
||||||
|
# Since Unit Tests are required to pass for each PR,
|
||||||
|
# we cannot disable them for documentation-only changes.
|
||||||
on:
|
on:
|
||||||
push:
|
pull_request:
|
||||||
branches: [trunk]
|
push:
|
||||||
pull_request:
|
branches: [trunk]
|
||||||
|
# Allow manually triggering the workflow.
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||||
|
concurrency:
|
||||||
|
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||||
|
# or the commit hash for any other events.
|
||||||
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Setup:
|
JSUnitTests:
|
||||||
runs-on: ubuntu-latest
|
name: JS Unit Tests
|
||||||
name: Setup
|
runs-on: ubuntu-latest
|
||||||
steps:
|
if: ${{ github.repository == 'WooCommerce/WooCommerce-Blocks' || github.event_name == 'pull_request' }}
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache node_modules
|
strategy:
|
||||||
id: cache-node-modules
|
fail-fast: false
|
||||||
uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
steps:
|
||||||
uses: actions/setup-node@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install Node Dependencies
|
- name: Use desired version of NodeJS
|
||||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
uses: actions/setup-node@v3
|
||||||
run: npm ci --no-optional
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Npm install and build
|
||||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
run: |
|
||||||
|
npm ci --no-optional
|
||||||
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: Store Build Assets
|
- name: blocks.ini setup
|
||||||
uses: actions/upload-artifact@v3
|
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
|
||||||
with:
|
|
||||||
name: build-assets
|
|
||||||
path: build/
|
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Run JavaScript Unit tests
|
||||||
id: composer-cache
|
run: npm run test
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-composer-
|
|
||||||
- name: Set up PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: "8.0" # This is not the PHP version used to run the tests, that is set by wp-env
|
|
||||||
coverage: none
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Composer install
|
PHPUnitTests:
|
||||||
run: composer install
|
name: PHP ${{ matrix.php }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
if: ${{ github.repository == 'WooCommerce/WooCommerce-Blocks' || github.event_name == 'pull_request' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
php:
|
||||||
|
- '7.4'
|
||||||
|
- '8.0'
|
||||||
|
- '8.1'
|
||||||
|
- '8.2'
|
||||||
|
|
||||||
PHPUnitTests:
|
env:
|
||||||
name: PHP ${{ matrix.php }}
|
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
||||||
needs: Setup
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
php: [ '7.4', '8.0' ]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Cache node_modules
|
- name: Set up Node.js
|
||||||
id: cache-node-modules
|
uses: actions/setup-node@v3
|
||||||
uses: actions/cache@v3
|
with:
|
||||||
env:
|
node-version-file: '.nvmrc'
|
||||||
cache-name: cache-node-modules
|
cache: npm
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
##
|
||||||
uses: actions/setup-node@v3
|
# This allows Composer dependencies to be installed using a single step.
|
||||||
with:
|
#
|
||||||
node-version-file: '.nvmrc'
|
# Since the tests are currently run within the Docker containers where the PHP version varies,
|
||||||
cache: 'npm'
|
# the same PHP version needs to be configured for the action runner machine so that the correct
|
||||||
|
# dependency versions are installed and cached.
|
||||||
|
##
|
||||||
|
- name: Set up PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '${{ matrix.php }}'
|
||||||
|
ini-file: development
|
||||||
|
coverage: none
|
||||||
|
|
||||||
- name: Download Build Assets
|
# Ensure that Composer installs the correct versions of packages.
|
||||||
uses: actions/download-artifact@v3
|
- name: Override PHP version in composer.json
|
||||||
with:
|
run: |
|
||||||
name: build-assets
|
composer config platform.php ${{ matrix.php }}
|
||||||
|
composer update
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: Install npm dependencies
|
||||||
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
|
||||||
- name: Get Composer cache directory
|
- name: Docker debug information
|
||||||
id: composer-cache
|
run: |
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
docker -v
|
||||||
|
docker-compose -v
|
||||||
|
|
||||||
- name: Set up Composer caching
|
- name: General debug information
|
||||||
uses: actions/cache@v3
|
run: |
|
||||||
env:
|
npm --version
|
||||||
cache-name: cache-composer-dependencies
|
node --version
|
||||||
with:
|
curl --version
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
git --version
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
svn --version
|
||||||
restore-keys: |
|
locale -a
|
||||||
${{ runner.os }}-composer-
|
|
||||||
- name: Install PHP deps
|
|
||||||
run: composer install
|
|
||||||
|
|
||||||
- name: Setup Permissions
|
- name: Start Docker environment
|
||||||
run: |
|
run: npm run wp-env start --update
|
||||||
mkdir -p ./wp-content/uploads/wc-logs
|
|
||||||
echo 'deny from all' > ./wp-content/uploads/wc-logs/.htaccess
|
|
||||||
chmod -R 777 ./
|
|
||||||
- name: Run PHPUnit tests
|
|
||||||
run: |
|
|
||||||
JSON='{"phpVersion": "${{ matrix.php }}"}'
|
|
||||||
echo $JSON > .wp-env.override.json
|
|
||||||
npm run wp-env start --update
|
|
||||||
npm run test:php
|
|
||||||
- name: Run PHPUnit tests (WooCommerce Development Version)
|
|
||||||
run: |
|
|
||||||
JSON='{"plugins": [".","https://downloads.wordpress.org/plugin/woocommerce.zip"], "phpVersion": "${{ matrix.php }}"}'
|
|
||||||
echo $JSON > .wp-env.override.json
|
|
||||||
npm run wp-env stop
|
|
||||||
rm -rf /home/runner/wp-env/*
|
|
||||||
npm run wp-env start --update
|
|
||||||
npm run test:php
|
|
||||||
JSUnitTests:
|
|
||||||
name: JS Unit Tests
|
|
||||||
needs: Setup
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache node_modules
|
- name: Log running Docker containers
|
||||||
id: cache-node-modules
|
run: docker ps -a
|
||||||
uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Setup node version and npm cache
|
- name: Docker container debug information
|
||||||
uses: actions/setup-node@v3
|
run: |
|
||||||
with:
|
npm run wp-env run tests-mysql "mysql --version"
|
||||||
node-version-file: '.nvmrc'
|
npm run wp-env run tests-wordpress "php --version"
|
||||||
cache: 'npm'
|
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 "locale -a"
|
||||||
|
|
||||||
- name: Download Build Assets
|
- name: Run PHPUnit tests
|
||||||
uses: actions/download-artifact@v3
|
run: npm run test:php
|
||||||
with:
|
|
||||||
name: build-assets
|
|
||||||
|
|
||||||
- name: blocks.ini setup
|
|
||||||
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
|
|
||||||
|
|
||||||
- name: Run JavaScript Unit tests
|
|
||||||
run: npm run test
|
|
||||||
|
|
|
@ -62,3 +62,4 @@ blocks.ini
|
||||||
/.wp-env.override.json
|
/.wp-env.override.json
|
||||||
/eslint_report.json
|
/eslint_report.json
|
||||||
/storybook/dist
|
/storybook/dist
|
||||||
|
.phpunit.result.cache
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
"automattic/jetpack-autoloader": "^2.9.1"
|
"automattic/jetpack-autoloader": "^2.9.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"wp-phpunit/wp-phpunit": "^6.0",
|
"phpunit/phpunit": "^8",
|
||||||
"woocommerce/woocommerce-sniffs": "0.1.3",
|
"woocommerce/woocommerce-sniffs": "0.1.3",
|
||||||
"yoast/phpunit-polyfills": "^1.0",
|
"yoast/phpunit-polyfills": "^1.0",
|
||||||
"mockery/mockery": "^1.4",
|
"mockery/mockery": "^1",
|
||||||
"wp-hooks/generator": "^0.9.0"
|
"wp-hooks/generator": "^0.9.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "7.4.32"
|
"php": "7.4.33"
|
||||||
},
|
},
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
"automattic/jetpack-autoloader": true,
|
"automattic/jetpack-autoloader": true,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@ services:
|
||||||
- WORDPRESS_DB_NAME
|
- WORDPRESS_DB_NAME
|
||||||
- WORDPRESS_DB_USER
|
- WORDPRESS_DB_USER
|
||||||
- WORDPRESS_DB_PASSWORD
|
- WORDPRESS_DB_PASSWORD
|
||||||
- WORDPRESS_TABLE_PREFIX=wp_test_
|
- WORDPRESS_TABLE_PREFIX=wptests_
|
||||||
- WP_CORE_DIR=/var/www/html
|
- WP_CORE_DIR=/var/www/html
|
||||||
- WP_TESTS_DIR=/tmp/wordpress-tests-lib
|
- WP_TESTS_DIR=/tmp/wordpress-tests-lib
|
||||||
- WOO_VERSION
|
- WOO_VERSION
|
||||||
|
|
|
@ -111,7 +111,7 @@
|
||||||
"@wordpress/e2e-test-utils": "10.1.0",
|
"@wordpress/e2e-test-utils": "10.1.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": "^4.9.0",
|
"@wordpress/env": "5.16.0",
|
||||||
"@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",
|
||||||
|
@ -5997,9 +5997,10 @@
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/@sindresorhus/is": {
|
"node_modules/@sindresorhus/is": {
|
||||||
"version": "2.1.1",
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
},
|
},
|
||||||
|
@ -16376,15 +16377,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@wordpress/env": {
|
"node_modules/@wordpress/env": {
|
||||||
"version": "4.9.0",
|
"version": "5.16.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@wordpress/env/-/env-5.16.0.tgz",
|
||||||
|
"integrity": "sha512-zx6UO8PuJBrQ34cfeedK1HlGHLFaj7oWzTo9tTt+noB79Ttqc4+a0lYwDqBLLJhlHU+cWgcyOP2lB6TboXH0xA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "GPL-2.0-or-later",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.0.0",
|
"chalk": "^4.0.0",
|
||||||
"copy-dir": "^1.3.0",
|
"copy-dir": "^1.3.0",
|
||||||
"docker-compose": "^0.22.2",
|
"docker-compose": "^0.22.2",
|
||||||
"extract-zip": "^1.6.7",
|
"extract-zip": "^1.6.7",
|
||||||
"got": "^10.7.0",
|
"got": "^11.8.5",
|
||||||
"inquirer": "^7.1.0",
|
"inquirer": "^7.1.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"ora": "^4.0.2",
|
"ora": "^4.0.2",
|
||||||
|
@ -21145,15 +21147,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cacheable-lookup": {
|
"node_modules/cacheable-lookup": {
|
||||||
"version": "2.0.1",
|
"version": "5.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||||
|
"integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/keyv": "^3.1.1",
|
|
||||||
"keyv": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cacheable-request": {
|
"node_modules/cacheable-request": {
|
||||||
|
@ -24411,14 +24410,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/decompress-response": {
|
"node_modules/decompress-response": {
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mimic-response": "^2.0.0"
|
"mimic-response": "^3.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dedent": {
|
"node_modules/dedent": {
|
||||||
|
@ -25438,8 +25441,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/duplexer3": {
|
"node_modules/duplexer3": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"devOptional": true,
|
"license": "BSD-3-Clause",
|
||||||
"license": "BSD-3-Clause"
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/duplexify": {
|
"node_modules/duplexify": {
|
||||||
"version": "3.7.1",
|
"version": "3.7.1",
|
||||||
|
@ -28643,17 +28646,6 @@
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/github-label-sync/node_modules/@sindresorhus/is": {
|
|
||||||
"version": "4.6.0",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/github-label-sync/node_modules/ajv": {
|
"node_modules/github-label-sync/node_modules/ajv": {
|
||||||
"version": "8.11.0",
|
"version": "8.11.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -28669,14 +28661,6 @@
|
||||||
"url": "https://github.com/sponsors/epoberezkin"
|
"url": "https://github.com/sponsors/epoberezkin"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/github-label-sync/node_modules/cacheable-lookup": {
|
|
||||||
"version": "5.0.4",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.6.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/github-label-sync/node_modules/commander": {
|
"node_modules/github-label-sync/node_modules/commander": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -28685,60 +28669,11 @@
|
||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/github-label-sync/node_modules/decompress-response": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"mimic-response": "^3.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/github-label-sync/node_modules/got": {
|
|
||||||
"version": "11.8.3",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@sindresorhus/is": "^4.0.0",
|
|
||||||
"@szmarczak/http-timer": "^4.0.5",
|
|
||||||
"@types/cacheable-request": "^6.0.1",
|
|
||||||
"@types/responselike": "^1.0.0",
|
|
||||||
"cacheable-lookup": "^5.0.3",
|
|
||||||
"cacheable-request": "^7.0.2",
|
|
||||||
"decompress-response": "^6.0.0",
|
|
||||||
"http2-wrapper": "^1.0.0-beta.5.2",
|
|
||||||
"lowercase-keys": "^2.0.0",
|
|
||||||
"p-cancelable": "^2.0.0",
|
|
||||||
"responselike": "^2.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.19.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/github-label-sync/node_modules/json-schema-traverse": {
|
"node_modules/github-label-sync/node_modules/json-schema-traverse": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/github-label-sync/node_modules/mimic-response": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/github-slugger": {
|
"node_modules/github-slugger": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -28928,44 +28863,30 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/got": {
|
"node_modules/got": {
|
||||||
"version": "10.7.0",
|
"version": "11.8.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz",
|
||||||
|
"integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sindresorhus/is": "^2.0.0",
|
"@sindresorhus/is": "^4.0.0",
|
||||||
"@szmarczak/http-timer": "^4.0.0",
|
"@szmarczak/http-timer": "^4.0.5",
|
||||||
"@types/cacheable-request": "^6.0.1",
|
"@types/cacheable-request": "^6.0.1",
|
||||||
"cacheable-lookup": "^2.0.0",
|
"@types/responselike": "^1.0.0",
|
||||||
"cacheable-request": "^7.0.1",
|
"cacheable-lookup": "^5.0.3",
|
||||||
"decompress-response": "^5.0.0",
|
"cacheable-request": "^7.0.2",
|
||||||
"duplexer3": "^0.1.4",
|
"decompress-response": "^6.0.0",
|
||||||
"get-stream": "^5.0.0",
|
"http2-wrapper": "^1.0.0-beta.5.2",
|
||||||
"lowercase-keys": "^2.0.0",
|
"lowercase-keys": "^2.0.0",
|
||||||
"mimic-response": "^2.1.0",
|
|
||||||
"p-cancelable": "^2.0.0",
|
"p-cancelable": "^2.0.0",
|
||||||
"p-event": "^4.0.0",
|
"responselike": "^2.0.0"
|
||||||
"responselike": "^2.0.0",
|
|
||||||
"to-readable-stream": "^2.0.0",
|
|
||||||
"type-fest": "^0.10.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10.19.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/got/node_modules/type-fest": {
|
|
||||||
"version": "0.10.0",
|
|
||||||
"dev": true,
|
|
||||||
"license": "(MIT OR CC0-1.0)",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/graceful-fs": {
|
"node_modules/graceful-fs": {
|
||||||
"version": "4.2.10",
|
"version": "4.2.10",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
|
@ -38076,11 +37997,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mimic-response": {
|
"node_modules/mimic-response": {
|
||||||
"version": "2.1.0",
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=10"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
@ -47508,14 +47430,6 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/to-readable-stream": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/to-regex": {
|
"node_modules/to-regex": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -55066,7 +54980,9 @@
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"@sindresorhus/is": {
|
"@sindresorhus/is": {
|
||||||
"version": "2.1.1",
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@sinonjs/commons": {
|
"@sinonjs/commons": {
|
||||||
|
@ -62485,14 +62401,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@wordpress/env": {
|
"@wordpress/env": {
|
||||||
"version": "4.9.0",
|
"version": "5.16.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@wordpress/env/-/env-5.16.0.tgz",
|
||||||
|
"integrity": "sha512-zx6UO8PuJBrQ34cfeedK1HlGHLFaj7oWzTo9tTt+noB79Ttqc4+a0lYwDqBLLJhlHU+cWgcyOP2lB6TboXH0xA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "^4.0.0",
|
"chalk": "^4.0.0",
|
||||||
"copy-dir": "^1.3.0",
|
"copy-dir": "^1.3.0",
|
||||||
"docker-compose": "^0.22.2",
|
"docker-compose": "^0.22.2",
|
||||||
"extract-zip": "^1.6.7",
|
"extract-zip": "^1.6.7",
|
||||||
"got": "^10.7.0",
|
"got": "^11.8.5",
|
||||||
"inquirer": "^7.1.0",
|
"inquirer": "^7.1.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"ora": "^4.0.2",
|
"ora": "^4.0.2",
|
||||||
|
@ -65764,12 +65682,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cacheable-lookup": {
|
"cacheable-lookup": {
|
||||||
"version": "2.0.1",
|
"version": "5.0.4",
|
||||||
"dev": true,
|
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||||
"requires": {
|
"integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==",
|
||||||
"@types/keyv": "^3.1.1",
|
"dev": true
|
||||||
"keyv": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"cacheable-request": {
|
"cacheable-request": {
|
||||||
"version": "7.0.2",
|
"version": "7.0.2",
|
||||||
|
@ -67966,10 +67882,12 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"decompress-response": {
|
"decompress-response": {
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"mimic-response": "^2.0.0"
|
"mimic-response": "^3.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dedent": {
|
"dedent": {
|
||||||
|
@ -68663,7 +68581,7 @@
|
||||||
},
|
},
|
||||||
"duplexer3": {
|
"duplexer3": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"devOptional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"duplexify": {
|
"duplexify": {
|
||||||
"version": "3.7.1",
|
"version": "3.7.1",
|
||||||
|
@ -70820,10 +70738,6 @@
|
||||||
"octonode": "^0.10.2"
|
"octonode": "^0.10.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sindresorhus/is": {
|
|
||||||
"version": "4.6.0",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "8.11.0",
|
"version": "8.11.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -70834,45 +70748,13 @@
|
||||||
"uri-js": "^4.2.2"
|
"uri-js": "^4.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cacheable-lookup": {
|
|
||||||
"version": "5.0.4",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"decompress-response": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"mimic-response": "^3.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"got": {
|
|
||||||
"version": "11.8.3",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@sindresorhus/is": "^4.0.0",
|
|
||||||
"@szmarczak/http-timer": "^4.0.5",
|
|
||||||
"@types/cacheable-request": "^6.0.1",
|
|
||||||
"@types/responselike": "^1.0.0",
|
|
||||||
"cacheable-lookup": "^5.0.3",
|
|
||||||
"cacheable-request": "^7.0.2",
|
|
||||||
"decompress-response": "^6.0.0",
|
|
||||||
"http2-wrapper": "^1.0.0-beta.5.2",
|
|
||||||
"lowercase-keys": "^2.0.0",
|
|
||||||
"p-cancelable": "^2.0.0",
|
|
||||||
"responselike": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"json-schema-traverse": {
|
"json-schema-traverse": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
|
||||||
"mimic-response": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"dev": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -71002,30 +70884,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"got": {
|
"got": {
|
||||||
"version": "10.7.0",
|
"version": "11.8.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz",
|
||||||
|
"integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@sindresorhus/is": "^2.0.0",
|
"@sindresorhus/is": "^4.0.0",
|
||||||
"@szmarczak/http-timer": "^4.0.0",
|
"@szmarczak/http-timer": "^4.0.5",
|
||||||
"@types/cacheable-request": "^6.0.1",
|
"@types/cacheable-request": "^6.0.1",
|
||||||
"cacheable-lookup": "^2.0.0",
|
"@types/responselike": "^1.0.0",
|
||||||
"cacheable-request": "^7.0.1",
|
"cacheable-lookup": "^5.0.3",
|
||||||
"decompress-response": "^5.0.0",
|
"cacheable-request": "^7.0.2",
|
||||||
"duplexer3": "^0.1.4",
|
"decompress-response": "^6.0.0",
|
||||||
"get-stream": "^5.0.0",
|
"http2-wrapper": "^1.0.0-beta.5.2",
|
||||||
"lowercase-keys": "^2.0.0",
|
"lowercase-keys": "^2.0.0",
|
||||||
"mimic-response": "^2.1.0",
|
|
||||||
"p-cancelable": "^2.0.0",
|
"p-cancelable": "^2.0.0",
|
||||||
"p-event": "^4.0.0",
|
"responselike": "^2.0.0"
|
||||||
"responselike": "^2.0.0",
|
|
||||||
"to-readable-stream": "^2.0.0",
|
|
||||||
"type-fest": "^0.10.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"type-fest": {
|
|
||||||
"version": "0.10.0",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
|
@ -77388,7 +77262,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mimic-response": {
|
"mimic-response": {
|
||||||
"version": "2.1.0",
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"min-document": {
|
"min-document": {
|
||||||
|
@ -83789,10 +83665,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"to-readable-stream": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"to-regex": {
|
"to-regex": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
|
|
@ -86,7 +86,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/config wp-scripts test-e2e --config tests/e2e/config/jest.performance.config.js -- performance",
|
"test:performance": "npm run wp-env:config && cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.performance.config.js -- performance",
|
||||||
"test:php": "npm run wp-env run phpunit '/var/www/html/wp-content/plugins/${PWD##*/}/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/${PWD##*/}/phpunit.xml.dist'",
|
"test:php": "wp-env run tests-wordpress /var/www/html/wp-content/plugins/${PWD##*/}/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/${PWD##*/}/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",
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
"@wordpress/e2e-test-utils": "10.1.0",
|
"@wordpress/e2e-test-utils": "10.1.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": "^4.9.0",
|
"@wordpress/env": "5.16.0",
|
||||||
"@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",
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit
|
<phpunit
|
||||||
bootstrap="tests/bootstrap.php"
|
bootstrap="tests/bootstrap.php"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="false"
|
convertErrorsToExceptions="true"
|
||||||
convertNoticesToExceptions="false"
|
convertNoticesToExceptions="true"
|
||||||
convertWarningsToExceptions="false"
|
convertWarningsToExceptions="true"
|
||||||
verbose="true"
|
verbose="true"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPUnit bootstrap file
|
||||||
|
*
|
||||||
|
* @package WooCommerce Blocks
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Blocks\Tests;
|
namespace Automattic\WooCommerce\Blocks\Tests;
|
||||||
|
|
||||||
// Require composer dependencies.
|
// Require composer dependencies.
|
||||||
|
@ -7,7 +13,7 @@ require_once dirname( __DIR__ ) . '/vendor/autoload.php';
|
||||||
// Determine the tests directory (from a WP dev checkout).
|
// Determine the tests directory (from a WP dev checkout).
|
||||||
// Try the WP_TESTS_DIR environment variable first.
|
// Try the WP_TESTS_DIR environment variable first.
|
||||||
$_wc_tests_framework_dir = dirname( dirname( __DIR__ ) ) . '/woocommerce/tests/legacy';
|
$_wc_tests_framework_dir = dirname( dirname( __DIR__ ) ) . '/woocommerce/tests/legacy';
|
||||||
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
||||||
|
|
||||||
// Next, try the WP_PHPUNIT composer package.
|
// Next, try the WP_PHPUNIT composer package.
|
||||||
if ( ! $_tests_dir ) {
|
if ( ! $_tests_dir ) {
|
||||||
|
@ -43,10 +49,11 @@ tests_add_filter( 'muplugins_loaded', __NAMESPACE__ . '\\manually_load_plugins'
|
||||||
* Manually install plugins being tested.
|
* Manually install plugins being tested.
|
||||||
*/
|
*/
|
||||||
function manually_install_plugins() {
|
function manually_install_plugins() {
|
||||||
|
\WC_Install::install();
|
||||||
\Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Installer::class )->maybe_create_tables();
|
\Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Installer::class )->maybe_create_tables();
|
||||||
}
|
}
|
||||||
|
|
||||||
tests_add_filter( 'setup_theme', __NAMESPACE__ . '\\manually_install_plugins' );
|
tests_add_filter( 'init', __NAMESPACE__ . '\\manually_install_plugins' );
|
||||||
|
|
||||||
// Start up the WP testing environment.
|
// Start up the WP testing environment.
|
||||||
require $_tests_dir . '/includes/bootstrap.php';
|
require $_tests_dir . '/includes/bootstrap.php';
|
||||||
|
|
|
@ -141,17 +141,19 @@ class BlockTemplateUtilsTest extends WP_UnitTestCase {
|
||||||
* Test set_has_theme_file_if_fallback_is_available when the template file has no fallback.
|
* Test set_has_theme_file_if_fallback_is_available when the template file has no fallback.
|
||||||
*/
|
*/
|
||||||
public function test_set_has_theme_file_if_fallback_is_available_no_fallback() {
|
public function test_set_has_theme_file_if_fallback_is_available_no_fallback() {
|
||||||
$template_file = array(
|
$query_result = array(
|
||||||
'slug' => 'single-product',
|
(object) array(
|
||||||
'theme' => 'twentytwentytwo',
|
'slug' => 'single-product',
|
||||||
|
'theme' => 'twentytwentytwo',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$query_result = (object) array(
|
$template_file = (object) array(
|
||||||
'slug' => 'archive-product',
|
'slug' => 'archive-product',
|
||||||
'theme' => 'twentytwentytwo',
|
'theme' => 'twentytwentytwo',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse( BlockTemplateUtils::set_has_theme_file_if_fallback_is_available( $template_file, $query_result ) );
|
$this->assertFalse( BlockTemplateUtils::set_has_theme_file_if_fallback_is_available( $query_result, $template_file ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue