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

Font Library: use resolvable domain in test #54763

Merged
merged 1 commit into from Sep 25, 2023

Conversation

matiasbenedetto
Copy link
Contributor

What?

Fix test than can break in different test envs depending the URL of the test env run.

Why?

To validate the URL of a font collection we have a function that calls wp_http_validate_url() function.
Because wp_http_validate_url() function uses the PHP native function gethostbyname() function that is not being mocked. We just mock the URL request to fetch the data. If the domain of the url used can't be resolved or the url of the test env is not localhost, the url like https://localhost/example can be evaluated as invalid.

How?

To fix this problem easily we can use a resolvable domain as wordpress.org in the test instead of localhost.

Testing Instructions

Run PHP unit tests and check if they are running ok.

@matiasbenedetto matiasbenedetto added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Feature] Typography Font and typography-related issues and PRs Needs PHP backport Needs PHP backport to Core labels Sep 23, 2023
@github-actions
Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollection.php

@mikachan mikachan added the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Sep 25, 2023
Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@mikachan mikachan merged commit dc2517e into trunk Sep 25, 2023
54 checks passed
@mikachan mikachan deleted the fix/use-resolvable-domain-in-test branch September 25, 2023 09:57
@github-actions github-actions bot added this to the Gutenberg 16.8 milestone Sep 25, 2023
@mikachan
Copy link
Member

I just cherry-picked this PR to the release/16.7 branch to get it included in the next release: 4225a35

mikachan pushed a commit that referenced this pull request Sep 25, 2023
@mikachan mikachan removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Sep 25, 2023
@youknowriad youknowriad added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Needs PHP backport Needs PHP backport to Core labels Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Typography Font and typography-related issues and PRs [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants