Don't mock HTTP requests for the external-http testsuite#4004
Merged
westonruter merged 4 commits intodevelopfrom Jan 16, 2020
Merged
Don't mock HTTP requests for the external-http testsuite#4004westonruter merged 4 commits intodevelopfrom
westonruter merged 4 commits intodevelopfrom
Conversation
pierlon
commented
Dec 21, 2019
| * @package AMP | ||
| */ | ||
|
|
||
| define( 'AMP_IMG_DIMENSION_TEST_INVALID_FILE', dirname( __FILE__ ) . '/assets/not-exists.png' ); |
Contributor
Author
There was a problem hiding this comment.
I've refactored the external-http group of tests to their own class called AMP_Image_Dimension_Extract_Download_Test, which makes it easier to add and remove from test suites.
| ], | ||
|
|
||
| 'url_simple' => [ | ||
| 'https://imgur.com/f462IUj' . PHP_EOL, |
Contributor
Author
There was a problem hiding this comment.
This endpoint throws a 404 so I've updated it.
Contributor
Author
|
|
2215b10 to
1f752c4
Compare
1f752c4 to
73c24c6
Compare
Contributor
Author
|
|
73c24c6 to
68db8b1
Compare
westonruter
approved these changes
Jan 16, 2020
1c3b965 to
68686d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While working on #3954, an error with the Crowdsignal embed test surfaced (not pertaining to the aforementioned PR). That error should not have occurred as it would receive a mocked HTTP response body to sanitize, but due to a mishandled case in WP < 5.1 the HTTP request was not mocked (fixed in #3956). Because of this, it was discovered that Crowdsignal's embed response had been changed, causing the assertion of the expected HTML to fail.
This has brought into light the possibility of the other supported embeds returning HTML being unaccounted for and could lead to broken reports of them, while we are happily contented with the passing tests.
This PR seeks to change the way how embeds are tested by adding a new PHPUnit testsuite called
external-http, which will allow the HTTP requests of these embeds to pass through unfiltered and allow for a true comparison of the expected HTML.Checklist