Skip to content

Conversation

@mdawaffe
Copy link
Member

Changes proposed in this Pull Request:

As of https://core.trac.wordpress.org/changeset/45811/, Core now caches API Endpoints' Schemas, but does not flush that cache between individual tests.

Our tests sometimes change the expected schema.

To flush the cache, we user Core's method of re-instantiating the entire Controller object.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

No - bug fix.

Testing instructions:

  1. Ensure you're running a version of core Core that includes at least r45811. As of today, the latest nightly works.
    • If you're using the docker image: yarn docker:wp core update --version=nightly
  2. phpunit --group=publicize
    • If you're using the docker image: yarn docker:phpunit --group=publicize

Prior to this patch, you'd see a couple errors about the jetpack_publicize_message key being missing.

After this patch, there are no errors.

Proposed changelog entry for your changes:

None needed? Only affects tests.

…ta key.

In addition to testing our Custom Post Types, ensure that normal Posts hav
the `jetpack_publicize_message` key in the response.
As of https://core.trac.wordpress.org/changeset/45811/, Core now caches
API Endpoints' Schemas, but does not flush that cache between individual
tests.

Our tests sometimes change the expected schema.

To flush the cache, we user Core's method of re-instantiating the entire
Controller object.
@mdawaffe mdawaffe added [Feature] Publicize Now Jetpack Social, auto-sharing [Status] Needs Review This PR is ready for review. Unit Tests labels Aug 16, 2019
@mdawaffe mdawaffe added this to the 7.7 milestone Aug 16, 2019
@mdawaffe mdawaffe requested review from a team and roccotripaldi August 16, 2019 20:03
@mdawaffe mdawaffe self-assigned this Aug 16, 2019
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello mdawaffe! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D31643-code before merging this PR. Thank you!

@jetpackbot
Copy link
Collaborator

jetpackbot commented Aug 16, 2019

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: September 3, 2019.
Scheduled code freeze: August 27, 2019

Generated by 🚫 dangerJS against b6d738d

Ensure we do everything in `->tearDown()` in the opposite order of what
happened in `->setUp()`.
@matticbot
Copy link
Contributor

mdawaffe, Your synced wpcom patch D31643-code has been updated.

Copy link
Contributor

@roccotripaldi roccotripaldi left a comment

Choose a reason for hiding this comment

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

Impressive sleuthing here. The tests pass for me locally, once Travis is happy, ship it!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants