Skip to content

tests/Integration: Add FileTest#819

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

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

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Mar 19, 2023

This is a regression test for #812.

@jtojnar
Copy link
Member Author

jtojnar commented Mar 20, 2023

@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
Copy link
Contributor

Art4 commented May 23, 2023

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.

@jtojnar jtojnar force-pushed the redirect-tests branch 3 times, most recently from 3cf2b9f to bdb50df Compare May 23, 2023 18:01
Copy link
Member Author

@jtojnar jtojnar left a comment

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.

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
Copy link
Contributor

Art4 commented Jun 25, 2025

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
Copy link
Member Author

jtojnar commented Jun 25, 2025

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
Copy link
Member Author

jtojnar commented Jun 26, 2025

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