Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running npm run test:php is broken after wp-env update to wp-env 5.0.0 #7263

Closed
westonruter opened this issue Sep 20, 2022 · 1 comment · Fixed by #7264
Closed

Running npm run test:php is broken after wp-env update to wp-env 5.0.0 #7263

westonruter opened this issue Sep 20, 2022 · 1 comment · Fixed by #7264
Assignees
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes.
Milestone

Comments

@westonruter
Copy link
Member

Bug Description

With the update to wp-env 5.0.0, running npm run test:php now results in a fatal error. This package update had a backwards-incompatible change as explained in the release notes:

Breaking Changes

  • Removed the WP_PHPUNIT__TESTS_CONFIG environment variable from the phpunit container. This removes automatic support for the wp-phpunit/wp-phpunit Composer package. To continue using the package, set the following two environment variables in your phpunit.xml file or similar: WP_TESTS_DIR="" and WP_PHPUNIT__TESTS_CONFIG="/wordpress-phpunit/wp-tests-config.php".
  • Removed the generated /var/www/html/phpunit-wp-config.php file from the environment.

We didn't catch it via CI because GHA doesn't run Docker to run the tests. When running in the local Docker-based dev environment, however, it is broken.

Expected Behaviour

Running PHPUnit tests, both npm run test:php and npm run test:php:xdebug, should work successfully.

Screenshots

$ npm run test:php

> amp-wp@ test:php /home/westonruter/repos/amp
> wp-env run phpunit 'WORDPRESS_TABLE_PREFIX=wptests_ WP_TESTS_DIR=/var/www/wordpress-develop/tests/phpunit /var/www/html/wp-content/plugins/amp/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/amp/phpunit.xml.dist $npm_config_args'

ℹ Starting 'WORDPRESS_TABLE_PREFIX=wptests_ WP_TESTS_DIR=/var/www/wordpress-develop/tests/phpunit /var/www/html/wp-content/plugins/amp/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/amp/phpunit.xml.dist $npm_config_args' on the phpunit container. 

Starting aabe871bb4b92d5867707c9f76aa7c03_tests-mysql_1 ... done
Starting aabe871bb4b92d5867707c9f76aa7c03_tests-wordpress_1 ... done

wp_die() called
Message: <p>There has been a critical error on this website.</p><p><a href="https://wordpress.org/support/article/faq-troubleshooting/">Learn more about troubleshooting WordPress.</a></p>
Title: WordPress &rsaquo; Error
Args:
        response: 500
        code: internal_server_error
        exit: 
        back_link: 
        link_url: 
        link_text: 
        text_direction: ltr
        charset: UTF-8
        additional_errors: array (
)

PHP Version

No response

Plugin Version

2.3.0

AMP plugin template mode

Standard, Transitional, Reader

WordPress Version

No response

Site Health

No response

Gutenberg Version

No response

OS(s) Affected

No response

Browser(s) Affected

No response

Device(s) Affected

No response

Acceptance Criteria

No response

Implementation Brief

No response

QA Testing Instructions

No response

Demo

No response

Changelog Entry

No response

@westonruter westonruter added the Bug Something isn't working label Sep 20, 2022
@westonruter westonruter added this to the v2.3.1 milestone Sep 20, 2022
@westonruter westonruter modified the milestones: v2.3.1, v2.4 Jan 26, 2023
@thelovekesh
Copy link
Collaborator

QA Passed ✅

On running npm run test:php at the base branch(develop) tests are getting executed as expected inside the wp-env docker instance.

Note: wp-env is also getting used by the Build Test & Measure workflow to run multisite PHPUnit tests, which is also working as expected so far.

image

@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants