Skip to content

tests/Integration: Add FileTest#819

Closed
jtojnar wants to merge 3 commits into
simplepie:masterfrom
jtojnar:redirect-tests
Closed

tests/Integration: Add FileTest#819
jtojnar wants to merge 3 commits into
simplepie:masterfrom
jtojnar:redirect-tests

Conversation

@jtojnar

@jtojnar jtojnar commented Mar 19, 2023

Copy link
Copy Markdown
Member

This is a regression test for #812.

@jtojnar

jtojnar commented Mar 20, 2023

Copy link
Copy Markdown
Member Author

@Art4 Do you think something like this is reasonable?

I tried finding a library for the PHP server but after reviewing the following, I gave up and wrote my own helper class:

@Art4

Art4 commented May 23, 2023

Copy link
Copy Markdown
Contributor

I would have said that it is not worth the effort to create such a test because the File class will be deprecated. But since you've already done the work, we can keep the test. Requiring a separate library for it would definitely be too much.

Comment thread tests/Integration/HttpServer.php Outdated
Comment thread tests/Integration/Fixtures/redirects.php Outdated
Comment thread tests/Integration/Fixtures/redirects.php Outdated
Comment thread tests/Integration/Fixtures/redirects.php Outdated
Comment thread tests/Integration/Fixtures/redirects.php Outdated
Comment thread tests/Integration/Fixtures/redirects.php Outdated
@jtojnar jtojnar force-pushed the redirect-tests branch 3 times, most recently from 3cf2b9f to bdb50df Compare May 23, 2023 18:01

@jtojnar jtojnar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the review, updated. I think this integration test will be useful for PSR-18 as well since how the permanent/temporary redirection interact with get_final_url is non-trivial. Though there we at least will not need to spawn a server since that will support mocking.

Comment thread tests/Integration/HttpServer.php Outdated
Comment thread tests/Integration/Fixtures/redirects.php Outdated
jtojnar added 2 commits June 25, 2025 09:47
Since the custom HTTP client in File based on curl cannot really be mocked,
let’s add an actual HTTP server to allow for integration and regression testing
during the transition to PSR-18 implementations.
This is a regression test for simplepie#812.
@Art4

Art4 commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

I've found this library for mocking a webserver: https://packagist.org/packages/donatj/mock-webserver

  • 👍 still supports PHP 7.1 up to PHP 8.4
  • 👍 open for port and host selection
  • 👍 maintained
  • all (only 1) dependencies are compatible
  • MIT licence

I've looked into the code and it looks very good and straight forward. I've added it in #909.

@jtojnar

jtojnar commented Jun 25, 2025

Copy link
Copy Markdown
Member Author

This was superseded by #909.

@jtojnar jtojnar closed this Jun 25, 2025
@jtojnar jtojnar deleted the redirect-tests branch June 25, 2025 20:56
@jtojnar

jtojnar commented Jun 26, 2025

Copy link
Copy Markdown
Member Author

The test cases are ported to the new infrastructure in #918.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants