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

wp-parsely: Only trigger warning when actually specifying a version via filter #2344

Merged
merged 5 commits into from
Aug 13, 2021

Conversation

jblz
Copy link
Member

@jblz jblz commented Aug 10, 2021

Description

This is currently reporting an erroneous warning: "Invalid value configured via wpvip_parsely_version filter" even when a site is not overriding the filter. This only performs the check when it is.

This also includes a first pass at integration tests for the plugin. Since WordPress is already mostly loaded and the plugin is sourced prior to running phpunit test cases, we have to hook into the phpunit bootstrap file to vary behavior. We do that by leveraging environment variables specified on the test runner host machine.

These will be hooked into CI in a follow up PR.

Changelog Description

Plugin Updated: VIP Parse.ly Integration -- Fix spurious PHP Warning

We made some behind-the-scenes changes that will help customers try Parse.ly on their sites more easily.

Checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally (or has an appropriate fallback).
  • This change works and has been tested on a Go sandbox.
  • This change has relevant unit tests (if applicable).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Steps to Test

  1. Check out PR
  2. Run docker
  3. Execute each of the following. The tests should pass without visible PHP Warnings:
    • WP_TESTS_DIR=/tmp/wordpress-tests-lib ./bin/phpunit-docker.sh --file tests/parsely/test-mu-parsely-integration.php
    • WPVIP_PARSELY_INTEGRATION_TEST_MODE=option_enabled WP_TESTS_DIR=/tmp/wordpress-tests-lib ./bin/phpunit-docker.sh --file tests/parsely/test-mu-parsely-integration.php
    • WPVIP_PARSELY_INTEGRATION_TEST_MODE=filter_enabled WP_TESTS_DIR=/tmp/wordpress-tests-lib ./bin/phpunit-docker.sh --file tests/parsely/test-mu-parsely-integration.php
    • WPVIP_PARSELY_INTEGRATION_TEST_MODE=filter_and_option_enabled WP_TESTS_DIR=/tmp/wordpress-tests-lib ./bin/phpunit-docker.sh --file tests/parsely/test-mu-parsely-integration.php
    • WPVIP_PARSELY_INTEGRATION_PLUGIN_VERSION=2.5 WPVIP_PARSELY_INTEGRATION_TEST_MODE=filter_enabled WP_TESTS_DIR=/tmp/wordpress-tests-lib ./bin/phpunit-docker.sh --file tests/parsely/test-mu-parsely-integration.php
  4. Execute the following:
    • WPVIP_PARSELY_INTEGRATION_PLUGIN_VERSION=2.4 WPVIP_PARSELY_INTEGRATION_TEST_MODE=filter_enabled WP_TESTS_DIR=/tmp/wordpress-tests-lib ./bin/phpunit-docker.sh --file tests/parsely/test-mu-parsely-integration.php
      • Tests should pass, but there should a PHP warning: PHP Warning: Invalid value configured via wpvip_parsely_version filter: 2.6 in /app/wp-parsely.php on line 59:

@jblz jblz force-pushed the wp-parsely-fix-version-fallback branch 3 times, most recently from 2685406 to 56da886 Compare August 11, 2021 19:29
@jblz jblz force-pushed the wp-parsely-fix-version-fallback branch from 56da886 to b6998b1 Compare August 12, 2021 19:17
@jblz jblz self-assigned this Aug 12, 2021
@jblz jblz marked this pull request as ready for review August 12, 2021 19:33
@jblz jblz requested a review from a team as a code owner August 12, 2021 19:33
Copy link
Contributor

@pschoffer pschoffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@pauarge pauarge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Noting that tests run without explicitly setting WP_TESTS_DIR=/tmp/wordpress-tests-lib as per the PR description.

@pauarge pauarge merged commit 72ddfa2 into master Aug 13, 2021
@pauarge pauarge deleted the wp-parsely-fix-version-fallback branch August 13, 2021 09:43
@jblz
Copy link
Member Author

jblz commented Aug 13, 2021

Thanks for the reviews!

Noting that tests run without explicitly setting WP_TESTS_DIR.. as per the PR description.

In my case, it didn't. I've got that specified in my .profile to a different location for an unrelated project and it erred out, so I included it in the command here for good measure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants