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

tests: fix setUp()/tearDown() methods #290

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

justlevine
Copy link
Contributor

@justlevine justlevine commented Sep 19, 2024

What

This PR fixes the ::setUp() and ::tearDown() methods in our PHPUnit test classes. More specifically

  • The WPGraphQL schema is cleared between each test.
  • Our local tear-downs occur before parent::tearDown()
  • We now delete options in ::tearDown() that were created in ::setUp()
  • Removed unnecessary $wpdb calls.

As a result, markTestSkipped() has been removed from CoreTableTest and CoreVideoTest since they're no longer necessary.

Additionally, the class namespace was added to UpdateCallbacksTest.php since the autoload error was bothering me.

Why

CoreImageTest is for some reason what's causing CoreTableTest etc to skip their attributes registration, and clearing the WPGraphQL schema allows it to work again.

Made sense to apply it for equal measure, since the underlying issue is lifecycle issue between the plugin/PHPUnit (and not an issue in PHPUnit itself) and we don't want it rearing its head again forcing someone to disable a previously-working test.

Additional fixes are low-hanging fruit that don't deserve their own PR or the headache of working around merge conflicts during this sprint.

@justlevine justlevine requested a review from a team as a code owner September 19, 2024 17:10
Copy link

changeset-bot bot commented Sep 19, 2024

🦋 Changeset detected

Latest commit: d5e2c6b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wp-graphql-content-blocks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jasonbahl
Copy link
Contributor

@justlevine looks like one of the workflows is failing: https://github.com/wpengine/wp-graphql-content-blocks/actions/runs/10945698414

@justlevine
Copy link
Contributor Author

justlevine commented Sep 19, 2024

@justlevine looks like one of the workflows is failing: https://github.com/wpengine/wp-graphql-content-blocks/actions/runs/10945698414

@jasonbahl That's either temporary issue or someone just committed an accidental breaking change to the nightlies. FWIW it passed for us: rtCamp#21

@jasonbahl
Copy link
Contributor

Ok cool. I can look at it later

@theodesp
Copy link
Member

Ta

@theodesp theodesp merged commit 96bad40 into wpengine:main Sep 25, 2024
10 of 11 checks passed
@justlevine justlevine deleted the tests/fix-skipped-tests branch September 25, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants