elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.42k stars 270 forks source link

Mock external requests in sitemap tests #828

Open leonstafford opened 3 years ago

leonstafford commented 3 years ago

As a developer I don't want to wait for slow network requests to run test suite So that I don't avoid running them frequently and they aren't susceptible to side effects

Currently, running composer test takes too long due to fetching external resources in the sitemap tests.

We should use local test data to simulate the responses we see from current external resources.

Sitemap test scope should at least cover:

leonstafford commented 3 years ago

@palmiak suitable for Hacktoberfest?

leonstafford commented 2 years ago

for now, running the sitemap external request tests fail on GH Actions runner due to access blockage.

we can mark tests with a group as "external requests" as per phpunit docs:

--exclude-group

Exclude tests from the specified group(s). A test can be tagged as belonging to a group using the @group annotation.

This will allow to keep running those locally, but skip on CI and optionally allow users to skip those slow external requests when testing locally, by passing same --exclude-group argument