j0k3r / graby

Graby helps you extract article content from web pages
MIT License
363 stars 73 forks source link

Add test fixtures using rector #282

Closed jtojnar closed 2 years ago

jtojnar commented 2 years ago

Use composer rector (or composer rector -- --dry-run) to run the automated refactoring.

j0k3r commented 2 years ago

Maybe you can separate the code improvement (fn, ??, etc.) in a separate PR to reduce the noise?

jtojnar commented 2 years ago

I can separate them out but then CI will not pass. It should still be feasible to review commit by commit.

jtojnar commented 2 years ago

Or I can move the ci commit to the new PR too.

jtojnar commented 2 years ago

Removed the ci part for now.

Still need to replace file_get_contents with actual fetchContent and capture the resources.

jtojnar commented 2 years ago

I got nerd sniped quite hard by this but I had this on to-do list for few other projects. Now running composer rector should automatically add fixtures for fetchContent calls on Graby constructed without a second argument.

jtojnar commented 2 years ago

Rector is a tool for automated code transformation. The transformation rule runs Graby and extract headers using RecordingHttpClient will also update the functional tests – the last commit is fully produced by the transformation rule without any manual changes.

jtojnar commented 2 years ago

If you check out the PR, you can try it yourself by removing the last commit and running composer rector. (Comment out this line if you do not want the code modernization.)

j0k3r commented 2 years ago

Can you rebase against the master? And it'll be good to merge

j0k3r commented 2 years ago

Good job @jtojnar 👊