Skip to content

Commit

Permalink
Fix issues with WordPress 5.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Oct 29, 2023
1 parent b8b7166 commit c1682e5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,20 @@ jobs:
- name: npm install
run: npm ci

- name: Patch @wordpress/env for WordPress versions 5.0 and older
run: sed -i -e "s/--anchor=\"define( 'WP_DEBUG',\"/--anchor=\"define('WP_DEBUG',\"/" node_modules/@wordpress/env/lib/wordpress.js
if: startsWith(matrix.wordpress, '4.') || startsWith(matrix.wordpress, '5.0')

- name: Install WordPress
run: npm run wp-env start

- name: Fix wp-tests-config.php for older WordPress versions
- name: Fix wp-tests-config.php for WordPress versions 5.1-5.3
run: npm run wp-env run tests-wordpress -- sh -c "sed -e \"/^require.*wp-settings.php/d\" -e \"s/define( 'ABSPATH', dirname( __FILE__ ) . '\\/' );/define( 'ABSPATH', '\\/var\\/www\\/html\\/' );\\n\\tdefine( 'WP_DEFAULT_THEME', 'default' );/\" /var/www/html/wp-config.php > /wordpress-phpunit/wp-tests-config.php"
if: startsWith(matrix.wordpress, '5.')
if: startsWith(matrix.wordpress, '5.') && !startsWith(matrix.wordpress, '5.0')

- name: Fix wp-tests-config.php for WordPress versions 5.0 and older
run: npm run wp-env run tests-wordpress -- sh -c "sed -e \"/^require.*wp-settings.php/d\" -e \"s/define('ABSPATH', dirname(__FILE__) . '\\/');/define( 'ABSPATH', '\\/var\\/www\\/html\\/' );\\n\\tdefine( 'WP_DEFAULT_THEME', 'default' );/\" /var/www/html/wp-config.php > /wordpress-phpunit/wp-tests-config.php"
if: startsWith(matrix.wordpress, '4.') || startsWith(matrix.wordpress, '5.0')

- name: Running PHPUnit tests
run: npm run test-php
Expand Down

0 comments on commit c1682e5

Please sign in to comment.