Opened 7 years ago
Last modified 4 years ago
#42076 new enhancement
Allow the external HTTP tests to run internally
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | needs-unit-tests |
Focuses: | Cc: |
Description
The tests in the external-http
group are the worst. They not only perform calls out over the internet, but they rely on a combination of wordpress.org, wordpress.com, example.org, example.com, and youtube.com.
The external oEmbed tests that use youtube.com (Tests_External_HTTP_OEmbed
) can probably be removed. They're technically fragile (YouTube could change the structure of their embed URLs and cause the tests to fail) and don't actually test anything that core has control over.
It _should_ be possible to run the rest of the external-http tests against a local web server running PHP. As an example, frameworks such as Behat usually run against a server being run by PHP's built in web server.
If the test files from wordpress.com and wordpress.org were downloaded and placed into the test suite data directory, they could be served by a local web server and therefore tested without a remote HTTP request.
Spinning up a local web server in PHP could be made optional via a flag or an environment variable, and could be enabled on Travis by default.
It may even be that the functionality that is being tested by these external HTTP tests can be abstracted and made testable without performing an HTTP request at all, or it could be that the functionality is already covered by unit tests in the Requests framework.
Feedback / ideas welcome.
In 41712: